SELECT
cscart_ult_product_prices.product_id,
MIN(
IF(
cscart_ult_product_prices.percentage_discount = 0,
cscart_ult_product_prices.price,
cscart_ult_product_prices.price - (
cscart_ult_product_prices.price * cscart_ult_product_prices.percentage_discount
)/ 100
)
) AS price
FROM
cscart_ult_product_prices
WHERE
cscart_ult_product_prices.product_id IN (290, 291)
AND cscart_ult_product_prices.lower_limit = 1
AND cscart_ult_product_prices.company_id = 1
AND cscart_ult_product_prices.usergroup_id IN (0, 0, 1)
GROUP BY
cscart_ult_product_prices.product_id