SQL语句转换成LINQ怎么写 select *,
(select CollectData from LastestData z1 where z1.DeviceMonitorObjectID=b.DeviceMonitorObjectID and z1.DeviceMonitorObjectID='215764AC-F19D-43B2-B942-8F0E5669EEBF') '水',
(select CollectData from LastestData z1 where z1.DeviceMonitorObjectID=b.DeviceMonitorObjectID and z1.DeviceMonitorObjectID='215764AC-F19D-43B2-B942-8F0E5669EEBF') '电'
from dbo.EnterpriseSiteDevice a
inner join dbo.DeviceMonitorObject b
on a.EnterpriseSiteDeviceID=b.EnterpriseSiteDeviceID
//没看出你的水电查询条件不什么不一样...
var query=from a in dbo.EnterpriseSiteDevice
join b in dbo.DeviceMonitorObject
on a.EnterpriseSiteDeviceID equals b.EnterpriseSiteDeviceID
select new
{
a,
b,
水=LastestData.Where(z1=>z1.DeviceMonitorObjectID == b.DeviceMonitorObjectID && z1.DeviceMonitorObjectID =="215764AC-F19D-43B2-B942-8F0E5669EEBF").Select(z1=>z1.CollectData),
电=LastestData.Where(z1=>z1.DeviceMonitorObjectID == b.DeviceMonitorObjectID && z1.DeviceMonitorObjectID =="215764AC-F19D-43B2-B942-8F0E5669EEBF").Select(z1=>z1.CollectData)
};