SQL question on an outer join
From: <fergus_vr01_at_yahoo.com>
Date: Fri, 9 May 2008 20:40:53 -0700 (PDT)
Message-ID: <8ad201c2-d87f-4688-b7fc-34dc0ea2c534@w7g2000hsa.googlegroups.com>
1
2
ColA ColB Col_C
Date: Fri, 9 May 2008 20:40:53 -0700 (PDT)
Message-ID: <8ad201c2-d87f-4688-b7fc-34dc0ea2c534@w7g2000hsa.googlegroups.com>
Hello,
Learning SQL - will appreciate any help.
Here is the case:
Two tables with 0..n relationship
TableA TableB ----------- -------------- ColA ColB ColA_FK Col_C
Data
TableA.ColA
1
2
Table B
ColB ColA_FK Col_C
11 2 12345 12 2 99999
Resultset:
ColA ColB Col_C
1 - - 2 12 99999
In case no data exists in TableB for ColA=11, 1 from TableA shows up
in result without any data from TableB
However, in case of 2 from ColA, we want to record from TableB with
Col_C = 99999
I can do the outer join - however, how do I limit it so it picks only the row with 9999?
Thanks in advance.
Fergus
Received on Fri May 09 2008 - 22:40:53 CDT