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 |
1sqlover
Yak Posting Veteran
56 Posts |
Posted - 2006-10-12 : 18:16:16
|
I would like to perform the following query:1. Count the number of times a number (ProductID) is in a certain row.2. Display the top 25 numbers that were grouped together by (1) or ProductID.FieldsProductID, ProductName, CustomerName, QtyThanks |
|
1sqlover
Yak Posting Veteran
56 Posts |
Posted - 2006-10-12 : 18:21:55
|
I guess I should have made myself clear. I want to not only count the number of times PRODUCTID (Distinct) appears but include it with outher information.SELECT COUNT(DISTINCT ProductID), ProductName FROM Table1epoh |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-10-12 : 20:05:07
|
[code]select ProductID, ProductName, count(*)from Table1group by ProductID, ProductName[/code] KH |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
1sqlover
Yak Posting Veteran
56 Posts |
Posted - 2006-10-12 : 21:19:38
|
Khtan, thank you for the tip.madhivanan, thanks for the links. |
 |
|
|
|
|