SQL: Combine Select count(*) from multiple tables

后端 未结 8 647
迷失自我
迷失自我 2020-12-08 13:08

How do you combine multiple select count(*) from different table into one return?

I have a similar sitiuation as this post

but I want one return.

I t

8条回答
  •  鱼传尺愫
    2020-12-08 14:05

    SELECT 
    (select count(*) from foo1 where ID = '00123244552000258')
    +
    (select count(*) from foo2 where ID = '00123244552000258')
    +
    (select count(*) from foo3 where ID = '00123244552000258')
    

    This is an easy way.

提交回复
热议问题