Select t1.B1, t1.N1, t2.B2, t2.N2
From
(Select Sum (Brutto) as B1, Sum (Netto) as N1
FROM Table 1
where ORDER_DATE between '19.09.11' and '19.12.11') t1
,
(Select Sum (Brutto) as B2, Sum (Netto) as N2
FROM Table 1
where ORDER_DATE > trunc(add_months(sysdate,-3))) t2
If you are trying to get the rows from both tables,
but the data is different then you want a union all.
Code:
select *
from ( select sum (brutto) as b1, sum (netto) as n1
from table 1
where order_date between '19.09.11' and '19.12.11'
union all
select sum (brutto) as b2, sum (netto) as n2
from table 1
where order_date > trunc(add_months(sysdate,-3)))
order by 1;
Note: the main difference between simply using a comma (1) or union all (2) is visualisation of the resulting table, i.e.
(1) present all four columns from the two resultnig tables side by side (= resulting table with 4 columns and 1 row), while
(2) presents results from one table in one column and results from the second result table in a second column (= resulting table with two columns and two rows).
Bookmarks