Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gtaipalus
Starting Member
6 Posts |
Posted - 2009-08-10 : 14:53:44
|
| I have a SQL 2005 table that looks like this (2 columns, multiple rows per patient):PatientID Allergy---------- --------1 Fish1 Peanuts2 Wheat2 Dairy3 CoconutI need to create a query or temp table that displays the records like this (2 columns and 1 row for each patient):PatientID Allergy---------- --------1 Fish, Peanuts2 Wheat, Dairy3 CoconutI found a similar posting here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=127132However this solution moves all PatientID's and Allergies to a single row and single column, instead of a separate row for each patient. Any idea's are appreciated.Thank you!GT |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
|
|
gtaipalus
Starting Member
6 Posts |
Posted - 2009-08-10 : 15:03:40
|
| I know that it is a duplicate. Sorry about the multiple postings.GT |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-08-10 : 15:10:08
|
| HiI have posted the answer here ..http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=130940can you delete the duplicates if you wish..-------------------------R..http://code.msdn.microsoft.com/SQLExamples/http://msdn.microsoft.com/hi-in/library/bb500155(en-us).aspx |
 |
|
|
|
|
|