Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to make query to aggregate data and show %s

Status
Not open for further replies.

lsgtechuser

Programmer
Feb 3, 2003
59
US
the table i have is setup with the following fields DemoGraphCol1, Location...

Values for DemoGraphCol1 are codes for age ranges
25to35, 35to45, 45to55 and 55andolder

lets say the location column has a list of towns
TownA,TownB,TownC etc...

I'm trying to make a query that will give a count grouped by Location and DemoGraphCol1 and show the count, but will also show the percentage in another column of the total people in that given location.
Getting the group by is straight forward, i'm just trying to get the percentage in the query as well.

select location, demographcol1,count(*), (percentage_of_totalhere) from mytable
group by location, demographcol1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top