linq to sql:2计算结果

时间:2014-12-17 14:09:03

标签: asp.net linq-to-sql

我想在LINQ to SQL中执行以下操作:

    Select count(*) as count_1,
   (select count(*) from tableName2) as count_2 FROM tableName
    Where x = y

结果应为

Column 1 | column 2
--------------------
    50        34

1 个答案:

答案 0 :(得分:0)

你需要做的是这样的事情:

select 
  (select count(*) 
   from tableName
   where x = y) as count_1, 
  (select count(*) 
   from tableName2) as count_2