Subtraction between two sql queries

前端 未结 11 2122
情歌与酒
情歌与酒 2020-12-10 00:54

I have 2 queries in MS SQL that return a number of results using the COUNT function.

I can run the the first query and get the first result and then run the other on

11条回答
  •  星月不相逢
    2020-12-10 01:23

    I know this is an old post but here is another solution that fit best to my needs (tested on firebird)

    SELECT c1-c2 from (select count(*) c1 from t1), (SELECT COUNT(*) c2 from t2);
    

提交回复
热议问题