SELECT product_promotion,
CASE product_promotion
WHEN Yes THEN SELECT SUM( basket_quantity * product_sale ) 'sum_basket'
WHEN No THEN SELECT SUM( basket_quantity * product_price ) 'sum_basket'
END
FROM basket
INNER JOIN product ON basket.product_id = product.product_id
WHERE customer_id = '$id'