开发者

How to convert this SQL query to Linq to Entity query?

开发者 https://www.devze.com 2022-12-27 20:48 出处:网络
could you help me please convert this SQL query to开发者_StackOverflow社区 Linq to Entity query? Thank you

could you help me please convert this SQL query to开发者_StackOverflow社区 Linq to Entity query? Thank you

select distinct item, count(item) as count 
from TableName 
where ColumnName = @parameter and (ColumnName2 = @parameter2 OR ColumnName3 = @parameter3)
group by item  order by item asc


from TableName in db.TableName
where TableName.Column1 == 'param1' 
    && ( TableName.Column2 == 'param2' || TableName.Column3 == 'param3' )
group item by new { TableName.Item } into t
orderby t.Key.Item
select new {  t.Key.Item,  ItemCount = t.Count() }
0

精彩评论

暂无评论...
验证码 换一张
取 消