[thelist] SQL Help Please

Joshua Olson joshua at waetech.com
Mon May 27 21:02:01 CDT 2002


----- Original Message -----
From: "rudy" <r937 at interlog.com>
Sent: Monday, May 27, 2002 8:44 PM

> let's start at the rear of the bus and move forwards
>
>    COALESCE(intfield1, intfield2, 0) AS fk_id
>
> if both intfield1 and intfield2 are null, you get a 0, and then if you try
> to do a left outer join to table 2, i'm guessing you won't find any rows,
> so i'd say in this case, don't even other with the join

Actually, I wanted the row even if it was 0, which is why I wrote it as an
outer join in this manner.  :)  I just wanted the value from table2 to come
in as null.

You've given some good food for thought, though my choice of COALESCE
might've thrown you off a bit.  I was looking for a more generalized case
where one value was calculated and the join had to happen on the value as
well as return that value within the query.

Thanks again,

-joshua






More information about the thelist mailing list