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!

Combining records in a single table 1

Status
Not open for further replies.

rjm13

Programmer
Feb 1, 2002
60
US
Hi All,

I have an issue that I don't know how to resolve (and don't know why it was done this way originally). I have a table with an identifier field (contract number), Service Category, a value field, and then a field that has a value of either "clients" or "Encounters".

What I need to do via a query is get the following:

Contract Number, Service Category, Client Value, Encounter Value all on the same line. and to let you know contract number, and service category combinations only occur twice

Is this possible

thanks,

R
 
A starting point:
SELECT C.[contract number], C.[Service Category], C.[value field] AS [Client Value], E.[value field] AS [Encounter Value]
FROM yourTable AS C INNER JOIN yourTable AS E ON C.[contract number]=E.[contract number] AND C.[Service Category]=E.[Service Category]
WHERE C.[some field]='clients' AND E.[some field]='Encounters'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, with a little tweaking, that worked out just fine.

Thanks again

R
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top