0

I been looking into group_concat, but it isn't working on SQL 2012, From what i have figured is that i have to have a functions to do so. But here is my question, i'm sending a SQLQuery by some c# code and want to return a datatabel.

'001' '123' '456' (and keep on going until we cannot find anymore phone number that is attached to the Cosnr.

From what i get now is. '001' 123' '001' 345'

Is there anyway, to send a single SQLQuery form C# to get back a datatabel looking like '001' '123' '456'

Hope anyone can help me. :)

sqlab
  • 6,412
  • 1
  • 14
  • 29
user3314032
  • 179
  • 10
  • `GROUP_CONCAT()` is a MySQL function, but not a SQL Server function. You can simulate this with the XML functionality. – Hart CO Feb 15 '14 at 18:04
  • Correct. `group_concat()` is a MySQL function. It is a bit painful to do in SQL Server, but there are many examples if you search on aggregation string concatenation. – Gordon Linoff Feb 15 '14 at 18:04
  • How does your tables look like? What's the content of the tables and what's your query statement? What's the connection to group_concat? – sqlab Feb 15 '14 at 18:05
  • The query is: SELECT name, lastnavn, companyname, adresse, postnr, email, phone FROM customer INNER JOIN customerEmail ON [dbo].[customer].customernr = [dbo].[customerEmail].customernr INNER JOIN [dbo].[kundetlf] ON [dbo].[customer].customernr = [dbo].[customerphone].customernr ORDER BY name ASC; I want to the "GROUP_CONCAT()" on the phone (Or atleast have something that has the same effect. – user3314032 Feb 15 '14 at 18:12

0 Answers0