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 |
|
Rheinhardt
Yak Posting Veteran
66 Posts |
Posted - 2009-11-12 : 04:59:27
|
| Hi,I have monthly sales data per item...Year Month QTY 2007 01 22007 02 02007 03 12007 04 22007 05 02007 06 5......I want to exclude Items where there isn't more than x amount of months with a quantity (qty) present.Example: The above only had sales in 4 months of the 12 months, I only want Item's sales data were the item has more than 5 months of data?Therfore the above Item will not be included.So how do I get the total (sum) number of "count" where there is quantity/qty present?Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-12 : 05:21:57
|
[code]select Itemsfrom [monthly sales data]where QTY > 0group by Itemshaving count(*) > 4[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|