Re: What is wrong with my logic? [message #39044] |
Mon, 10 June 2002 04:52 |
Jon
Messages: 483 Registered: May 2001
|
Senior Member |
|
|
You still aren't being clear, in my opinion. You say you want "a, b, and c from three tables". Does that mean "a" is on tbl1, "b" is on tbl2, "c" is on tbl3? If so, then you want tbl1, tbl2 and tbl3 in the FROM clause. The you go on to say that you want it "WHERE two tables match and the third is empty". If tbl3 is empty, you will never return "c" since it is on tbl3, so drop it from the SELECT and drop tbl3 from the FROM clause.
Now let's assume that you meant "a, b and c" are on tbl1 and tbl2, but not on tbl3. Fine. The SELECT clause should be "SELECT a, b, c" but the FROM clause should not contain tbl3. The FROM clause says "where [[not to be confused with the WHERE clause - I'll get to that]] are the items in the SELECT (a,b,c) to be found?". In tbl1 and tbl2. The WHERE clause says, "and under what conditions?". WHERE tbl1.key = tbl2.key and tbl3 is empty (NOT EXISTS clause).
Hope that helps.
|
|
|