SELECT
cscart_product_prices.product_id,
MIN(
IF(
cscart_product_prices.percentage_discount = 0,
cscart_product_prices.price,
cscart_product_prices.price - (
cscart_product_prices.price * cscart_product_prices.percentage_discount
)/ 100
)
) AS price
FROM
cscart_product_prices
WHERE
cscart_product_prices.product_id IN (
297, 296, 295, 294, 293, 292, 291, 290,
289, 288, 286, 285
)
AND cscart_product_prices.lower_limit = 1
AND cscart_product_prices.usergroup_id IN (0, 1)
GROUP BY
cscart_product_prices.product_id