Reputation: 339
Imagine: t1 = 1 t2 = 3 t3 = 5
I need to run individual selects on each table, and report the count in a single amount, ie:
select *
from (select count(*) from t1)
+ (select count(*) from t2)
+ (select count(*) from t3);
My end result should be = 9
Upvotes: 0
Views: 550
Reputation: 125214
select
(select count(*) from t1)
+ (select count(*) from t2)
+ (select count(*) from t3);
Upvotes: 1
Reputation: 183251
You're pretty close; you can write:
select (select count(*) from t1)
+ (select count(*) from t2)
+ (select count(*) from t3)
;
Upvotes: 3