0

I have a big query (SELECT DISTINCT clause) that returns a single row for ALL of the fields except one - for that single one, the row is returned several times. Here is what I mean: X Y Z A X Y Z B X Y Z C

The reason, I think, is because the last portion of the select statement happens to be a subquery that returns multiple values. Having more than a row is unacceptable, and I was wondering if there is a simple way (such as a loop or something even simpler like a certain clause) that concatenates the subquery results? I read through the following link: but I was hoping to find something simpler or something better looking. I cannot understand how the following works, so I am trying to avoid it.

How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field?

Community
  • 1
  • 1
LearnByReading
  • 1,813
  • 4
  • 21
  • 43
  • Sorry that is the very best method for what you want to do. – HLGEM Mar 23 '15 at 18:55
  • 1
    Show us your table structure and query... that answer should do what you need it to... but unless we know your structure, we would just be throwing darts in the dark, which is kinda fun... little scary... and pretty much guaranteed to causes someone pain... – Danimal111 Mar 23 '15 at 19:00

0 Answers0