Re: Repost: Syntax - or unavailability of same - for variable join??? Can anyone help?

Started by codeWarriorabout 22 years ago2 messagesgeneral
Jump to latest
#1codeWarrior
gpatnude@hotmail.com

You might have better success with the form of HAVING and appropriate use of
OR IS NULL as opposed to strict JOIN and WHERE conditions...

Similar to...

SELECT A.a, B.b, C.c FROM A, B, C
HAVING (A.b = B.b OR B.b IS NULL)
GROUP BY A.b;

--
Greg Patnude / The Digital Demention
2916 East Upper Hayden Lake Road
Hayden Lake, ID 83835
(208) 762-0762

"Ben" <reply@to-the-newsgroup.com> wrote in message
news:4c4c5dc750469f3b777c4f42ba9c0505@news.teranews.com...

I want to say:

SELECT tableA.stuff,tableB.morestuff,tableC.stillmorestuff
FROM tableA,
LEFT OUTER JOIN tableB ON (AB match conditions)
LEFT OUTER JOIN tableC ON (AC match conditions)
WHERE etc

However, in some cases, tableB does not have rows where the other two do
(it contains credit card records... but when an order is paid by check,

there is

Show quoted text

no record.)

What happens with the above syntax is I don't get a row at all.

Is there a way to say that if tableB has no row, I get blank columns?

Maybe I'm just looking at the wrong, but I can't seem to find out how, or
if, one can do this.

Thanks for any input.

--Ben

#2Ben
reply@to-the-newsgroup.com
In reply to: codeWarrior (#1)

I'll have a look at that; thank you very much for taking the time to reply. :)

Ben

On Mon, 16 Feb 2004 22:03:22 -0800, Greg Patnude wrote:

Show quoted text

You might have better success with the form of HAVING and appropriate use of
OR IS NULL as opposed to strict JOIN and WHERE conditions...

Similar to...

SELECT A.a, B.b, C.c FROM A, B, C
HAVING (A.b = B.b OR B.b IS NULL)
GROUP BY A.b;