I am making an online shopping site in PHP & My SQL where I need to fetch top records of top 5 products which are sold most. The table name is “order_details” with fields (Order_ID, Product_ID, Quantity, Price)
Can anybody help me that what should be my SQL query to fetch this record ?
I had a general idea of how to do the query but I wanted to be 100% sure. Google gives more stackoverflow threads than sitepoint. I linked the thread just incase I did it wrong so I can give the OP a starting point to redo the query.
Is that query something you’d recommend; i.e. would you do it this way? Purely asking for my learning experience since I’m trying to improve.
Edit-Noticed a typo in the query - updated it and fixed.
[quote=“RyanReese, post:6, topic:108724”]Is that query something you’d recommend; i.e. would you do it this way? Purely asking for my learning experience since I’m trying to improve.[/quote]it’s perfect