... QUERY ERROR!!! ...QUERY : SELECT (CASE WHEN unit_of_measure_code = '' THEN unit_price WHEN unit_of_measure_code = '' OR unit_of_measure_code = '' THEN unit_price * ELSE 9999999 END) AS 'unit_price',allow_line_disc,allow_invoice_disc,price_includes_vat FROM shop_sales_price WHERE type = 0 AND item_no = '' AND ((minimum_quantity <= 1 AND unit_of_measure_code = '') OR(minimum_quantity <= (1*1) AND (unit_of_measure_code = '' OR unit_of_measure_code = ''))) AND (sales_type = 1 AND sales_code='BI') AND (isnull(`shop_sales_price`.`starting_date`) AND isnull(`shop_sales_price`.`ending_date`) OR (isnull(`shop_sales_price`.`starting_date`) AND (`shop_sales_price`.`ending_date` >= '2017-03-25') OR (`shop_sales_price`.`starting_date` <= '2017-03-25') AND isnull(`shop_sales_price`.`ending_date`)) OR (`shop_sales_price`.`starting_date` <= '2017-03-25') AND (`shop_sales_price`.`ending_date` >= '2017-03-25')) AND (currency_code = '' OR currency_code = '') AND company = 'GSG-Stiegl Getränke u. Service' AND (unit_of_measure_code = '' OR unit_of_measure_code = '') ORDER BY unit_price ASC LIMIT 1