Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    12

    Question Unanswered: Can you make SELECT inside a SELECT clause?

    I have a problem. I need to make following kind of select clause if possible:

    SELECT A, B, C, (SELECT D FROM TABLE_A WHERE F = G), E, F
    FROM TABLE_A;

    Is it possible to use a SELECT inside SELECT, before WHERE part of the clause? This is because I need to create a view, where one column needs to have a value based on different conditions than other columns. Thank you for your help in advance.
    ------------------------------------
    Long days and pleasant nights
    - Roland the gunslinger
    ------------------------------------

  2. #2
    Join Date
    Nov 2002
    Posts
    272
    I'm pretty sure that's possible, as long as your subquery returns exactly 1 row.

    The best way to find out is to try it, I guess.

  3. #3
    Join Date
    May 2003
    Posts
    12
    I got it working. First, I couldn't make it work because there was summary functions and grouping included in the clause, but when I removed them, it worked very well.
    ------------------------------------
    Long days and pleasant nights
    - Roland the gunslinger
    ------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •