有没有办法用类似的语法执行以下操作?
select count(*) FROM main_iteminstance where item_type_id='TITLE'
-
select count(*) FROM main_catalog
换句话说,count1
减去 count2
。
答案 0 :(得分:1)
没试过,但你可以通过使用子查询来实现,如下所示:
select (query1.cnt-query2.cnt) from (select count(*) as cnt from ...) as query1, (select count(*) as cnt from ...) as query2