Re: SQL group by a range?

From: <efried_at_bellsouth.net>
Date: Wed, 27 Feb 2002 05:08:53 GMT
Message-ID: <hPZe8.6664$sH1.863466_at_e3500-atl2.usenetserver.com>


Something like this should work ...

select count(*) as 'A' from students where grade between 90 and 100 union
select count(*) as 'B' from students where grade between 80 and 89

In article <d351ed4f.0202261405.7a3ef902_at_posting.google.com>, neo_thinker_at_hotmail.com (Neothinker) wrote:
>I am trying to create a query that will tally the number of students
>with a grade from 90 to 100, 80 to 89, 70 to 79 ,... etc. So if I have
>a table that just had a "STUDENT" column and a "GRADE" column, what
>generic SQL could I use? As far as I know, the GROUP BY only accepts a
>column name, not an expression.



Eric Internet: efried_at_bellsouth.net Received on Wed Feb 27 2002 - 06:08:53 CET

Original text of this message