Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> SQL + questions
Dear experts,
I have a SQL plus question. I have a table like this (just five records):
Name Age ------------ --- chan tai man 10 lee ka wo 20 young man 21 old man 60 old woman 62
I want to do a query to count the number of
people with age <60 (young) and number of people >=60 (old). I hope the
result will
be like this:
Count(*) Age_range
I wonder whether the following statement can serve my purpose.
select count(*), decode(age, <60,'young',>=60,'old')Age_range from people
Please kindly advise. Thanks a lot !!!
Lee Ka wo, Ken
-