यह बहुत अधिक मुश्किल था। सही SQL:
USE lyf;
SELECT
*
FROM
`order` AS o
LEFT JOIN order_item AS oi ON oi.order_id = o.id
RIGHT JOIN product AS p ON oi.product_id = p.id
WHERE
IF(o.`date` IS NOT NULL, MONTH(o.`date`) = MONTH(NOW()), 1) = 1
यह बहुत अधिक मुश्किल था। सही SQL:
USE lyf;
SELECT
*
FROM
`order` AS o
LEFT JOIN order_item AS oi ON oi.order_id = o.id
RIGHT JOIN product AS p ON oi.product_id = p.id
WHERE
IF(o.`date` IS NOT NULL, MONTH(o.`date`) = MONTH(NOW()), 1) = 1