当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net - linq to sql: 2 counts as result

问题描述:

I want to do the following in LINQ to SQL:

 Select count(*) as count_1,

(select count(*) from tableName2) as count_2 FROM tableName

Where x = y

The result should be

Column 1 | column 2

--------------------

50 34

网友答案:

What you need to do is something like this:

select 
  (select count(*) 
   from tableName
   where x = y) as count_1, 
  (select count(*) 
   from tableName2) as count_2
分享给朋友:
您可能感兴趣的文章:
随机阅读: