Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple SQL Query

Re: Simple SQL Query

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 2 Jan 2007 13:55:09 -0800
Message-ID: <1167774907.467521.197190@v33g2000cwv.googlegroups.com>


Muggle wrote:
> Hello everyone,
>
> I have a simple requirement here. Need some help.
>
> I have two tables: TableA and TableB. I want to retrieve all the
> columns from TableA and column EVENT, if there is a record present,
> from TableB. The column that joins the two tables is YEAR.
>
> I am trying to execute a query like this :
>
> Select TableA.*, TableB.EVENT from TableA, TableB where
> TableA.YEAR='1900' and TableA.YEAR= TableB.YEAR
>
> Obviously this returns nothing when TableB has no entry for Year 1900.
> When there is no record present I want the query to return a null for
> the EVENT column and all the columns from TableA.
>
> I have no control over the database design.
>
> Thanks in advance
> Muggle

Investigate outer join syntax. This link includes several examples: http://groups.google.com/group/ORACLE_DBA_EXPERTS/browse_thread/thread/41863b746cbef8d2/ad1c7a3ee4911065?

Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Tue Jan 02 2007 - 15:55:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US