Question

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

Was it helpful?

Solution

You're pretty close; you can write:

 select (select count(*) from t1)
        + (select count(*) from t2)
        + (select count(*) from t3)
 ;

OTHER TIPS

select 
    (select count(*) from t1)
    + (select count(*) from t2)
    + (select count(*) from t3);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top