Avatar of onL0oker

asked on 

How to Retrieve Multiple Counts from a Single Table Query

Hi Experts, I'm trying to create a sql query that allows me to get a count of ages, gender, and interests. The main table consists of the users data, and the reference tables: ages, gender, and interests.

So the count for the age would retrieve the count of users 10-15. The second count, retrieve the number for gender, and it'll show the count for female and male. The third count, displays the interest within a preset of interest in the reference table interests. So let's say, 1 is games, 2 is basketball, and 3 is computer programming. The third count would grab the number for people interested in games, basketball, and computer. All these counts are retrieve into one query. Does anyone have an idea on how to accomplish this task? Thanks.
Microsoft SQL Server 2005SQL

Avatar of undefined
Last Comment

8/22/2022 - Mon