maxwell2323
asked on
How to concatenate one field from similar records
I have the results of a select query where all records have totally equal field values except for only one field, where the values are different. What I want to do in T-SQL is basically have just one record, where the one particular field has the unique values concatenated together, perhaps separated by commas or slashes or pipes or something (other than a space). For instance, see the file attached that has the results of the query. I want to get this record below out of the results: Joe 6/1/2005 Spinal injury,valve disease,migraine
resultsofselectquery.doc
resultsofselectquery.doc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hey,
I just made code ready made, but idea was same as Mr.Genius - mwvisa1 tolds...
So check dat link..
Yes Anthony, dynamic SQL is not what I meant. the coalesce approaches depends on filling variable first the using so it works well but will be limited when you can't use multiple statements then can use the xml trick shown...
Kevin
Kevin
ASKER
Great stuff. Thanks everyone !
You may want to double check that...