cascaded select

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    cascaded select

    Hello,

    how to do a select ... from select in MSSQL similar to Oracle? eg.

    select hour
    from (
    select substring( daily, 9,2 ) as hour
    from daytab
    where userid = 12
    )

    results in "incorrect syntax near ')'"

    thank you and regards
    Mark


  • Razvan Socol

    #2
    Re: cascaded select

    Hello, Mark

    In SQL Server (and in ANSI SQL-92), the derived tables (subqueries used
    in the FROM clause) need an alias:

    select hour
    from (
    select substring( daily, 9,2 ) as hour
    from daytab
    where userid = 12
    ) A

    Razvan

    Comment

    • Mark

      #3
      Re: cascaded select

      Thanks a lot !!!
      working for several month only with oracle made me totally forgot that.
      regards
      Mark


      "Razvan Socol" <rsocol@gmail.c om> schrieb im Newsbeitrag
      news:1120295724 .860959.260300@ z14g2000cwz.goo glegroups.com.. .[color=blue]
      > Hello, Mark
      >
      > In SQL Server (and in ANSI SQL-92), the derived tables (subqueries used
      > in the FROM clause) need an alias:
      >
      > select hour
      > from (
      > select substring( daily, 9,2 ) as hour
      > from daytab
      > where userid = 12
      > ) A
      >
      > Razvan
      >[/color]


      Comment

      Working...