You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCTP4.product_id, IFNULL(P3.new_price, 10) AS price FROM Products P4
LEFT JOIN
(SELECTP2.product_id, P1.new_priceFROM Products P1 RIGHT JOIN
(SELECT product_id, MAX(change_date) as change_date FROM Products WHERE change_date <="2019-08-16"GROUP BY product_id) P2 ONP1.product_id=P2.product_idANDP1.change_date=P2.change_date) P3