Helpful Information
 
 
Category: Firebird SQL Development
SELECT something FROM (SELECT something2 FROM ...) ...

Hi!
I would like to ask you for help. Working with Oracle I used to create selects like this :

SELECT a.x, b.y FROM my_table_1 a , my_table_2 b WHERE ...

This works perfectly in Firebird, too. BUT Firebird stops working in this case (only a little difference) :

SELECT a.x, b.y FROM my_table_1 a , (SELECT something from my_table_2) b WHERE ...


What can be the problem?
Thank you.

It appears that your statement is wrong, sub queries look like something simular to this:


SELECT column,column,etc FROM table_one WHERE ( SELECT AVG(column) FROM table_two ) < column

Not sure if that is what you are looking for.

Originally posted by jpenn
It appears that your statement is wrong


Trere is nothing wrong with
SELECT a.x, b.y FROM my_table_1 a , (SELECT something from my_table_2) b WHERE ...

I encountered the same problem comming from Oracle too.
Seems Firebird does not support such serialization of SQL.
This feature is very usefull as it is capable of serializing sql operations.

The only workaround I found is by making succesive views.
Very dificult to read and useless load of the dictionary.

I hope it will be implemented in version 2.

It is something like the WITH clause of the SQL99 standard.

But you can use something like this

SELECT (SELECT Name FROM table2 where table2.field1=table1.field1) from Table1










privacy (GDPR)