Error: BIGINT UNSIGNED value is out of range in '(`top15_11`.`st`.`quantity` - `top15_11`.`st`.`reserved`)'
Error No: 1690
SELECT *, pd.name AS name, p2c.category_id AS category_id,
p.status as status,
IFNULL(pa1.price, p.price) as price,
IFNULL(pa1.price_usd, p.price_usd) as price_usd,
IF(pa1.price IS NULL, p.old_price, IF(p.old_price > 0, p.old_price, p.price)) as old_price,
IF(pa1.price IS NULL, p.product_bage_class, 'action') as product_bage_class
FROM product p
LEFT JOIN product_action pa1 ON (pa1.product_id = p.product_id AND p.date_available <= NOW() AND p.status = '1' AND p.is_esale = 1 AND pa1.status = 1 AND (pa1.date_start IS NULL OR pa1.date_start <= NOW()) AND pa1.date_end >= NOW())
INNER JOIN product_description pd ON (pd.product_id = p.product_id)
INNER JOIN product_to_store p2s ON (p2s.product_id = p.product_id)
INNER JOIN sf_stock st ON (st.product_id = p.product_id)
INNER JOIN product_to_category p2c ON (p.product_id = p2c.product_id)
WHERE st.unit_id IN (SELECT su.unit_id FROM sf_unit su WHERE su.type = 'warehouse' AND su.on_site_flag = '1') AND st.is_active = '1' AND p.status = '1' AND p.is_esale = 1 AND (st.quantity - st.reserved) > 0 AND p.price > 0 AND p2c.category_id = '77'
GROUP BY p.product_id LIMIT 4