【发布时间】:2013-10-30 16:21:08
【问题描述】:
我有一个 SQL,我正在尝试将其转换为 c# 中的 Linq 表达式。
你能帮忙吗?
if (String.IsNullOrEmpty(alpha))
sql = "select distinct(Keyword) as word,
count(*) as Counter
from Keywords
group by keyword
order by keyword desc";
else
sql = "select distinct(Keyword) as word,
count(*) as Counter
from Keywords
where starts = N'{0}'
group by keyword
order by keyword desc";
我知道我在同一个查询中有不同的和计数的,没有什么好的方法可以弄清楚如何做到这一点?如何为此编写我的 LinQ 表达式?
【问题讨论】:
标签: c# .net sql linq linq-to-sql