linq多次Join on 查询语句的问题
当我用下面的linq语句查询出来的结果存在很多的重复数据:
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 1 CPU 1 1%
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 1 CPU 13 0%
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 1 CPU 25 0%
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 2 MEM 2 1.24GB
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 2 MEM 14 1.28GB
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 2 MEM 26 1.30GB
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 3 HDD 3 4.3G/3G
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 3 HDD 15 4.4G/4G
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 3 HDD 27 4.4G/3G
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 1 CPU 1 1%
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 1 CPU 13 0%
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 1 CPU 25 0%
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 2 MEM 2 1.24GB
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 2 MEM 14 1.28GB
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 2 MEM 26 1.30GB
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 3 HDD 3 4.3G/3G
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 3 HDD 15 4.4G/4G
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 3 HDD 27 4.4G/3G
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 1 CPU 1 1%
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 1 CPU 13 0%
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 1 CPU 25 0%
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 2 MEM 2 1.24GB
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 2 MEM 14 1.28GB
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 2 MEM 26 1.30GB
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 3 HDD 3 4.3G/3G
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 3 HDD 15 4.4G/4G
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 3 HDD 27 4.4G/3G
2 211.143.*.* iserver2 4 2010-8-11 0:00:00 1 陈** 4 CPU 4 0%
2 211.143.*.* iserver2 4 2010-8-11 0:00:00 1 陈** 4 CPU 16 0%
2 211.143.*.* iserver2 4 2010-8-11 0:00:00 1 陈** 4 CPU 28 0%
而实际上我需要的数据只需要
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 1 CPU 1 1%
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 2 MEM 2 1.24GB
1 211.143.*.* iserver1 1 2010-8-11 0:00:00 1 陈** 3 HDD 3 4.3G/3G
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 1 CPU 1 1%
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 2 MEM 2 1.24GB
1 211.143.*.* iserver1 2 2010-8-12 0:00:00 1 陈** 3 HDD 3 4.3G/3G
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 1 CPU 1 1%
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 2 MEM 2 1.24GB
1 211.143.*.* iserver1 3 2010-8-13 0:00:00 1 陈** 3 HDD 3 4.3G/3G
2 211.143.*.* iserver2 4 2010-8-11 0:00:00 1 陈** 4 CPU 4 0%
2 211.143.*.* iserver2 4 2010-8-11 0:00:00 1 陈** 4 CPU 16 0%
…… ……
………………
请我我语句要怎么改?
C# code
var serverSources = (from s in ddc.Servers
join sou in ddc.Sources on s.server_id equals sou.server_id
join ss in ddc.SourceStates on sou.source_id equals ss.source_id
join d in ddc.DateTimes on s.server_id equals d.server_id
join u in ddc.Users on d.use_id equals u.use_id
select new
{
s.server_id,
s.server_ip,
s.server_name,
d.dt_id,
d.dt_time,
d.dt_sourceRemark,
u.use_id,
u.usd_name,
sou.source_id,
sou.source_name,
ss.sourceState_id,
ss.sourceState_state
});
------解决方案--------------------