我有一个Sql Query
喜欢:
select distinct FROM_EMAILID,FROM_COUNTRY from SURVEY_VISITORS
where FROM_COUNTRY IN
(
select top 1 FROM_COUNTRY as FROM_COUNTRY from SURVEY_VISITORS
where FROM_COUNTRY<>'undefined'
group by FROM_COUNTRY order by COUNT(*) desc
)
我无法处理IN
Operator。
任何帮助将不胜感激。
对于子查询,我尝试过这种方式:
var innerQuery = (from t in VDC.SURVEY_VISITORS
group t by new
{
t.FROM_COUNTRY
} into g
orderby
g.Count() descending
select new
{
VisitorCount = (Int64?)g.Count(),
Country = g.Key.FROM_COUNTRY
}).FirstOrDefault();