首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

SQl用linq 怎么用linq 的语法写出来呀

2013-11-05 
SQl用linq 如何用linq 的语法写出来呀select Ent_ID,SDate,Count(distinct(callcode)) as CallIn_TRS_Sucf

SQl用linq 如何用linq 的语法写出来呀
select Ent_ID,SDate,Count(distinct(callcode)) as CallIn_TRS_Suc
from HD201311 where SDate='20131104' and STime>='140000' and ETIME<='145959' and CallType=2 and Len(Called)>5 and TotalLen>0
group by Ent_id,SDate

select Ent_ID,SDate,Sum(TotalLen) as CallIn_Len
from HD201311 where SDate='20131104' and STime>='140000' and ETIME<='145959' and CallType=2 and Len(Called)>5 and TotalLen>0
group by Ent_id,SDate

SQl如何用linq 的语法写出来呀 Linq
[解决办法]

var  query = from data in ds.Tables[0].AsEnumerable()
                         where data.Field<int>("CallType") == 2
                         group data by new { t1 = data.Field<int>("Ent_ID"), t2 = data.Field<string>("SDate") } into m
                         select new
                         {
                             
                             Ent_ID = m.Key.t1,
                             SDate = m.Key.t2,
                             CallAll = m.Select(x=>x.Field<string>("callcode")).Distintct().Count()   
                         };

热点排行