mercredi 24 décembre 2014

SQL query with left join to get rows in decreasing order from a specific date

I have two tables:


Product - productID, productName, productPrice


Purchased - productID, creationDate


Query - return a list of unique products that were bought since June 2nd with most expensive product returned first


For this I wrote below query:



SELECT Product.productID, Product.productName, Product.productPrice, Purchased.creationDate
FROM Product
LEFT JOIN Purchased
ON Product.productID=Purchased.productID
ORDER BY Product.productPrice DESC
WHERE Purchased.creationDate >02/06/2014


Could you please confirm if above written query is correct or I am doing any mistake. Thanks in advance!


Aucun commentaire:

Enregistrer un commentaire