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

Keep it simple - Crosstab

Status
Not open for further replies.

SidCharming

Technical User
Jun 18, 2003
73
0
0
US
I have a general phylosophy to keep my queries simple in the effect that there is not more than one making the end result. In the case I am working on I have a table that I need to make a crosstab to get the patient on one row instead of numerous records.

Example:
tableFollowUp
PATID: INTERVAL: RESULT:
001 24hour Yes
001 30day Yes
001 12month Yes
002 24hour Yes
002 30day Yes
003 24hour Yes

tableEnrollment
PATID: RESULT:
001 Yes
002 Yes
003 Yes
004 Yes


My goal is to have numerous tables like 'tableEnrollment' along with table 'tableFollowUp' looking like below...

PATID ENROLLMENT BASELINE CLOSURE FU24HR FU30DAY...
001 yes no yes yes yes
002 yes yes yes yes yes
003 yes yes yes yes <blank>

currently I have a query that relys on a crosstab of the FollowUp to get the patients information in one record.

Question: Can I do something in code or with raw sql to do the crosstab internally instead of relying on an external query?

I hope this is conveyed clearly.



Sid from Minnesota
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top