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

Access Query help for unnormalized table

Status
Not open for further replies.

cdborg

Programmer
Oct 4, 2004
7
CA
Greetings folks,
I have an application with one table, and I don't have time to normalize it, but asked to work with what is in place to produce some queries. In the query I have a field called Whopays which has the following data:

Whopays
INAC
Myself
Band Council
Band Council
Myself
Other
INAC
Myself
Other
Myself
Myself
Myself
Myself; other
Other; disability
Other; medical services
Other; parents

My client want me to produce a count of the following:

Band Council
INAC
Myself
Other
(Anything with Other in it)

So the output would look like

WhoPays Count
Band Council 2
INAC 2
Myself 7
Other 5

Is this possible?
 
Something like this ?
SELECT Left(WhoPays, InStr(WhoPays & ";", ";")-1) As [Who pays], Count(*) As [Count]
FROM yourTable
GROUP BY Left(WhoPays, InStr(WhoPays & ";", ";")-1);

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top