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 (
558893, 558889, 559332, 563215, 558919,
558821
)
AND cscart_product_prices.lower_limit = 1
AND cscart_product_prices.usergroup_id IN (0, 1)
GROUP BY
cscart_product_prices.product_id