Home > Archive > Microsoft SQL Server forum > July 2005 > cascaded select









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cascaded select
Mark

2005-07-02, 7:23 am

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

2005-07-02, 7:23 am

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

Mark

2005-07-02, 7:23 am

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


"Razvan Socol" <rsocol@gmail.com> schrieb im Newsbeitrag
news:1120295724.860959.260300@z14g2000cwz.googlegroups.com...
> 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
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com