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 (
2527, 11680, 2515, 2516, 2517, 2518,
15082, 2457, 2458, 2459, 2460, 2461,
2523, 2519, 2521, 2522
)
AND cscart_product_prices.lower_limit = 1
AND cscart_product_prices.usergroup_id IN (0, 1)
GROUP BY
cscart_product_prices.product_id