Oracle equiv of T-SQL UNION ALL query In T-SQL I can accumulate the results of two unioned queries using the following syntax:

SELECT Q.a, SUM(Q.b)
FROM (
SELECT f1 as a, f2 as b FROM TBL1
UNION ALL 
SELECT f1 as a, f2 as b FROM TBL2
)
GROUP BY Q.a


What is the equivalent in Oracle?
Assuming that you alias the inline view to Q, that syntax should be perfectly valid in Oracle.  I'm assuming that you actually have the alias in the SQL Server version as well.

SQL&gt; ed
Wrote file afiedt.buf

  1  select q.a, sum(q.b)
  2    from (select deptno a, sal b from emp
  3          union all
  4          select 40, 10000 from dual
  5         ) q
  6*  group by q.a
SQL&gt;
SQL&gt; /

         A   SUM(Q.B)
---------- ----------
        30       9406
        20      10880
        40      10000
        10       8753