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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how Do I create column groupings in a crosstab query

Status
Not open for further replies.

leeroi

Technical User
Jun 5, 2000
122
US
I have a crosstab query that lists the number of clients (DECnum)by County. County is my Row Heading. Currently, the Column heading is Age in months, which is set at one month intervals. I would like to reduce the number of columns by specifying age groupings. For example, Column 1 would for ages -1 to 6 months, Column 2 would include ages 7 to 18 months, etc.

I know I need to insert code for Pivot format, but I don't know how to do that. Here's the SQL code I currently have:

TRANSFORM Count(qryEntryReferralsbyCounty.DECNum) AS CountOfDECNum
SELECT qryEntryReferralsbyCountyByAge.[County Name], Count(qryEntryReferralsbyCountyByAge.DECNum) AS [Total Of DECNum]
FROM qryEntryReferralsbyCountyByAge
GROUP BY qryEntryReferralsbyCountyByAge.[County Name]
PIVOT qryEntryReferralsbyCountyByAge.age;
 
A starting point (Age in semesters)
PIVOT qryEntryReferralsbyCountyByAge.age\6;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This doesn't seem to be getting at what I need. For each column, I need specific age ranges as follows: -1-6; 7-18; 19-29; 30-36
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top