Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ssj_costy
Starting Member
1 Post |
Posted - 2009-12-02 : 06:58:34
|
| Hello, sorry if this seems easy...I have the tables Products(Id, Name, etc.), Order(Id, Date, Price, UserId) and OrderItem(OrderId, ProductId, Quantity).I want to select the top 5 best selling products. So, I should get the products that have the greatest quantity. (there can be several entries in OrderItem for the same product). |
|
|
kbhere
Yak Posting Veteran
58 Posts |
Posted - 2009-12-02 : 07:06:42
|
| In general, this can achieved by using,SELECT TOP 5 WITH TIES FROM Table1 JOIN Table2 etc..,Kindly post the Table structure and the sample date to get the exact query..Balaji.K |
 |
|
|
|
|
|