你能帮我转发这个SQL查询到Linq to Entity查询吗?谢谢
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
答案 0 :(得分:1)
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() }