a full out join b on ... --->
Return all rows from the a table and all rows from the b table.
Rows that do not satisfy the ON conditionare extended with nulls.
SELECT c.customer_id, c.o.order_id, c.account_mgr_id, o.sales_rep_id
FROM customers c FULL OUTER JOIN orders o
ON c.customer_id = o.customer_id
ORDER BY c.customer_id;
(
select kh.sm,kh.cnt,xh.cnt
from
(select sm,count(*) cnt from tbm_yd,tyt_yhda where dm=yd and to_char(khsj,'yyyymmdd') = '20030825' group by sm) kh,
(select sm,count(*) cnt from tbm_yd,tyt_xhyd where dm=yd and to_char(xhsj,'yyyymmdd') = '20030825' group by sm) xh
where kh.sm=xh.sm(+)
)
union all
(
select kh.sm,kh.cnt,xh.cnt
from
(select sm,count(*) cnt from tbm_yd,tyt_yhda where dm=yd and to_char(khsj,'yyyymmdd') = '20030825' group by sm) kh,
(select sm,count(*) cnt from tbm_yd,tyt_xhyd where dm=yd and to_char(xhsj,'yyyymmdd') = '20030825' group by sm) xh
where kh.sm(+)=xh.sm
)