Subject Re: [firebird-support] Re: Outer Join
Author Helen Borrie
At 10:47 PM 7/11/2003 +0000, you wrote:
> > Select Master.Master_ID,
> > Detail1.Master_ID,
> > Detail2.Master_ID,
> > from Master
> > join Detail2 on (Master.Master_ID = Detail2.Master_ID),
> > join Detail1 on (Master.Master_ID = Detail1.Master_ID)
>
>Notes:
>I remove dthe ',' from the end of line 3 and then get an exception on
>line 6 (last line):
>
>Invalid token.
>Dynamic SQL Error.
>SQL error code = -104.
>Token unknown - line 6, char -1.
>join.
>
>if I don't remove the comma.

CORRECT. I copy-pasted and didn't notice the comma.

>Remove the comma and nothing is returned.
>Remarks:
>
>I do think I want an outer join for I want a nulll if the there is no
>record.

OK, that's different to what you said.

>Only one may exist in either detail1 or detail2, I need to
>know, if one exists, which one.


In Firebird 1.5 you can use COALESCE and CASE statements. Since I seem
quite unclear about what you actually want, read the doc for these two
functions and see whether you can get what you need using one of them.

Otherwise just keep it simple and write a stored procedure.

heLen