#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    10
    Rep Power
    0

    Question 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.
  2. #2
  3. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Jun 2002
    Location
    Washington, DC
    Posts
    2,692
    Rep Power
    21
    It appears that your statement is wrong, sub queries look like something simular to this:
    Code:
    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.
    Last edited by jpenn; August 3rd, 2003 at 07:10 PM.
    ~ Joe Penn
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Bucharest, Romania
    Posts
    5
    Rep Power
    0
    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.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Ukraine
    Posts
    1
    Rep Power
    0
    But you can use something like this

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

IMN logo majestic logo threadwatch logo seochat tools logo