imho, the crossjoin solution is less straight forward than a union all would have been. select sum(a) from ( select count(*) a from tab1 union all select count(*) a from tab2 ) ;
Furthermore , using the union all, you can easily add more tables. Mike On Fri, Jun 26, 2009 at 4:06 AM, rob wolfe <rob.wo...@oraclegeeks.com>wrote: > > aww mayank you took all the fun out of it for the OP :-) > > Mayank wrote: > > hi shaunak > > > > you can use inline view for thet > > > > > > select (table1.s1+table2.s2) as T_sum > > from(Select count(*) as s1 from table1) table1,(select count(*) as s2 > > from table2) table2) > > > > > > Thsnks & Regards > > Mayank > > > > > > On Jun 26, 6:00 am, shaunak <shaunak.adgaon...@gmail.com> wrote: > > > >> Guys this is a very basic question but i am not able to find the > >> solution. Hope somebody comes up with solution for me. > >> > >> My requirement is to add the counts of two tables. > >> > >> select count(*) from table1 ; it returns 20 > >> select count(*) from table2; it returns 30 > >> > >> Now i want to have result in single query as 50 > >> > >> Can this be done in single query ? how ? can somebody help me > >> > >> Thanks > >> > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---