>I am trying to figure out a way to do this in SQL (for a report) but may have to do it in code, but I thought I would ask here first for any insight:
>
>I have a table called meetings, that has basic information about scheduled appointments. Some of the report fields for the report will come straight out of this table. Now there is another table that is called PatList that contains "user defined" elements. This table presents the user with a "Check List" for the scheduled meetings. It has the following fields:
>
>
>PatListID PrimaryKey
>PatListText Basically the question that gets asked (Payment Received, Food Required, etc.)
>
>
>The answers supplied by the user to the check-list are stored in a table called PatListAns that has the following fields:
>
>PatListAnsID PrimaryKey
>PatListID FK to ChkList Table
>MeetingID FK to Meetings Table
>RecordID FK to PATDDOPT Table
>
>
>The available possible answers are user defined also and that table (PATDDOPT) has :
>
>
>RecordID Primary Key
>StatusText
>
>
>I need to come up with a way to combine the fields from the meetings table, then add a column for each record in the Pat List table, and then get the text answer for those "fields" for each row of the meeting table:
>
>
>meetingID PatList.[PAYMENT RCVD] patlist.[Food RQD]
>
>123333 PENDING NO
>123334 RECEIVED YES
>
>
>I'm guessing I'm going to have to create Cursor on the client and then build the fields and then populate that cursor one row at a time with multiple queries....but I'm know I'm not the smartest guy on the planet, so I thought if some one knew how to do it all in a SQL Server call.
>
>Thanks
Could you post some example data and what you want from it?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.