Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: sql statement table join help
ghoy_at_yourplus.com (gareth hoy) wrote in message news:<e034dbf5.0301291056.8d7e2ea_at_posting.google.com>...
> Hi,
>
> i have 2 tables seller and manager.
>
> seller:
>
> seller_id
> ----------
> 01
> 02
> 03
> 04
> ----------
>
> manager:
>
> seller_id manager_id
> --------- ----------
> 01 a
> 02 a
> 03 b
> -----------------------
>
> as you can see from the tables seller "04" does not have a manager. I
> am trying to do a select statement that would output the following:
>
> seller_id manager_id
> --------- ----------
> 01 a
> 02 a
> 03 b
> 04
> -----------------------
>
> When you do a normal table join select statement, seller "04" is not
> included in the output as seller "04" does not exist in the manager
> table.
>
> What is the syntax for including seller "04" in the select output even
> though there is no entry in the manager table.
>
> please help,
> thanks,
>
> Gareth.
Gareth,
You use an outer join. The syntax with Oracle is to use "(+)" after the column name in your join thus:
SELECT manager.seller_id, manager.manager_id
FROM seller, manager
WHERE seller.seller_id = manager.seller_id(+)
Hope that helps.
Tim Kearsley
Database Manager
Milton Keynes Council
Received on Thu Jan 30 2003 - 03:11:57 CST
![]() |
![]() |