开发者

SQL Server 2008: Can you have a query where you do a diff on a count from two tables and then output result

开发者 https://www.devze.com 2023-01-23 12:50 出处:网络
What I would like to do is produce a query which returns the differ开发者_运维技巧ence between the sum of two other queries.I have tried, but I have failed.Here is what I tried:

What I would like to do is produce a query which returns the differ开发者_运维技巧ence between the sum of two other queries. I have tried, but I have failed. Here is what I tried:

Select ((SELECT COUNT(*) as B FROM Business) - (SELECT COUNT(*) as S FROM Shusiness)) as BusMinusShus


Yep, just put in a * in the count:

Select ((SELECT COUNT(*) FROM Business) - (SELECT COUNT(*) FROM Shusiness)) as BusMinusShus
0

精彩评论

暂无评论...
验证码 换一张
取 消