Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you bucket data? 2

Status
Not open for further replies.

pwills

Technical User
Sep 14, 2002
54
0
0
GB
E.g.
CustID Orders
1 10
2 5
3 5

View to show

Bucket Count
0-9 2
10-19 1
20-29 0
 
You could try this:

select case when Quantity < 10 then '0-9'
when Quantity between 10 and 19 then '10-20'
when Quantity >= 20 then '>= 20'
else null
end,count(*)
from

group by case when Quantity < 10 then '0-9'
when Quantity between 10 and 20 then '10-20'
when Quantity > 20 then '>20'
else null
end

Hope this helps.
 
Great Answer! You get another star (as if you needed more). -- What did you expect? This is FREE advice. LOL[ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top