0

I have a select in Entity SQL that returns simple strings, and I should concatenate to a string.

select (p.X + p.Y) from ExampleEntities.ExampleTable as p
group by p.X, p.Y

For example it returns 3 string and I should concatenate it to 1 string.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

0

I'm not sure if you want to concatenate all rows or per row, but this is a per row solution:

from p in ExampleEntities.ExampleTable
select string.Concat(p.X, p.Y, p.Z)

If you want a single result you'll need the following:

var temp = (from p in ExampleEntities.ExampleTable
            select string.Concat(p.X, p.Y, p.Z)).ToList();

string result = temp.Aggregate((current, next) => current + next);
Freek Buurman
  • 1,279
  • 1
  • 9
  • 15