0

Return a query in a new table

This my table Name. Age Ram. 18 Light 24 Lucy. 20 Tomas. 32 I want to select the people with an age of >14 years <=24 count them and if they are >=20 and <=24 retrieve their names Here what I've been writing is not compleate Select Age Count(Age) From table Case age when >14 and <= 24 then group by age And here idk where to go from here, is there a better way to go around this?

12th Aug 2021, 8:35 PM
Jace🎭
Jace🎭 - avatar
1 Réponse
+ 1
You would need two separate queries to get what want because count() is an aggregate function whereas selecing name is not. To retrieve the names: SELECT name FROM table WHERE age>=20 and age<=24; To count those rows: SELECT count(*) FROM table WHERE age>14 and age<=24;
13th Aug 2021, 4:45 AM
Giorgos