I have a table with a column that lists ages of users. I want to bin ages in arbitrary groupings (13-17,18-25, etc) and then be able to group by those bins and count users in each group. How can I accomplish this in a query?
2
votes
I got confused when you used the term 'bin'. The word I hear used most often is 'group', as in 'grouping records together'. So your statement "I want to bin ages in arbitrary groupings" could be worded clearer as "I want to group based on age".
- Jesse Webb
I think it's a subtle difference, but I would prefer to use "group" as in "group by" for the last operation in a SQL statement. "Binning" is just changing the label of a value, but doesn't necessarily have to be followed by a group by operation. Different strokes...
- Evan Zamir
2 Answers
5
votes