Subject | sub select befor from statment |
---|---|
Author | piotr.olszewski@ymail.com |
Post date | 2009-11-08T22:36:34Z |
Hi
I have a problem with using as parameter sub selection result
f.e.:
select main_table.*
(select first 1 second_table.some_field from second_table where second_table.field = main_table.filed) as check_field
from main_table
so far is ok, a get records from main_table and check_field from second_table
The problem is when i whant to use this filed in "where statmetn" like:
select main_table.*
(select first 1 second_table.some_field from second_table where second_table
field = main_table.filed) as check_field
from main_table
where check_field = 1
or when i whant to use check_fild as link to another sub select like:
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....
Piotr
I have a problem with using as parameter sub selection result
f.e.:
select main_table.*
(select first 1 second_table.some_field from second_table where second_table.field = main_table.filed) as check_field
from main_table
so far is ok, a get records from main_table and check_field from second_table
The problem is when i whant to use this filed in "where statmetn" like:
select main_table.*
(select first 1 second_table.some_field from second_table where second_table
field = main_table.filed) as check_field
from main_table
where check_field = 1
or when i whant to use check_fild as link to another sub select like:
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....
Piotr