0
我有一个选择实体SQL返回简单的字符串,我应该连接到一个字符串。实体SQL连接
select (p.X + p.Y) from ExampleEntities.ExampleTable as p
group by p.X, p.Y
例如,它返回3个字符串,我应该将它连接到1个字符串。
我有一个选择实体SQL返回简单的字符串,我应该连接到一个字符串。实体SQL连接
select (p.X + p.Y) from ExampleEntities.ExampleTable as p
group by p.X, p.Y
例如,它返回3个字符串,我应该将它连接到1个字符串。
我不知道,如果你想连接的所有行或每行,但是这是一个每行的解决方案:
from p in ExampleEntities.ExampleTable
select string.Concat(p.X, p.Y, p.Z)
如果你想要一个结果,你会需要以下条件:
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);
所以我想连接所有的“示例选择”行到1个字符串。 – user682157 2011-03-29 16:23:40
是的它是一个好主意,但你使用linq,我应该在实体sql中做到这一点。 – user682157 2011-03-30 16:17:11