Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    25

    Unanswered: sub-query in FROM clause

    hi,

    select sub.*
    from
    (
    select a
    from
    table1

    union all

    select a
    from
    table2
    )sub

    this query gives error in sybase 12.0. Whereas when the same query was executed in sybase 15 version, it works fine. This says that 12.0 does not support sub-query in FROM clause.

    Any other alternative to achieve this in sybase 12.0

    Got stuck, please help.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by alirulez999 View Post
    Any other alternative to achieve this in sybase 12.0
    Code:
    SELECT a
      FROM table1
    UNION ALL
    SELECT a
      FROM table2
    you don't need to use a subquery in the FROM clause for this query
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    A derived table is similar to a view
    So in pre 12.5 versions;
    Create a view of the union and then select from the view

Posting Permissions

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