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 |
|
kingjeremy
Starting Member
10 Posts |
Posted - 2007-09-07 : 19:45:39
|
| priceStockID productID supplierID price1 1 1 1002 1 2 1103 2 1 104 2 3 205 3 1 306 3 2 207 3 3 158 4 1 40how can I get the priceStockID for the lowest price of each product in the most efficient way the result table should be like belowpriceStockID productID supplierID price1 1 1 1003 2 1 107 3 3 158 4 1 40 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
|
|
kingjeremy
Starting Member
10 Posts |
Posted - 2007-09-08 : 19:16:56
|
| Thanks for the reply the link helped to understand how to build a query regarding to my question, though I later realized that I had to build a more complex one cause I do not want a product returned more than once which in my sample question when prices are same for the same product from different suppliers it will return the same product more than one. Anyway I have to refine my question by adding more fields like commissionRate, supplierScore to reduce the possibility to get duplicate results. |
 |
|
|
|
|
|