Subject Re: *** SPAM (5.7) *** Re: [firebird-support] sub select befor from statment
Author Kjell Rilbe
Dimitry Sibiryakov wrote:

>>select main_table.*
>>(select first 1 second_table.some_field from second_table where second_table.field = main_table.filed) as check_field
>>(select first 1 third_table.some_field from third_table where third.field = check_fild) as check_field2
>>from main_table
>>
>>i know that this kind of solution works on sysbase and it's really make easier to do it.....
>>
>>Please tell mi that this is also posslible with firebird, a have 2.1.1
>>version on window xp sp3, and pleas tell mi how to do it....
>
>
> Why do you use such strange syntax at all? Don't Sybase have JOINs?
>
> select main_table.*, second_table.some_field as check_field,
> third_table.some_field as check_field2
> from main_table
> left join second_table on second_table.field = main_table.filed
> left join third_table on third.field=second_table.some_field

But isn't it rather complicated to achieve the "first 1" semantics in
the OP's way using joins?

How would you suggest to do that? (Not that I can't see a solution, just
not a very neat one...)

Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64