Wednesday, January 13, 2010

sql subquery: select from results from another select statement

To select values from results returned by another select statement we can use the following syntax

Select * from
(select..from..where..) x

The x at the end is the table alias representing the results from the (select..from..where) statement. Without this we get errors like

Incorrect syntax near ')'.

No comments: