Hi all,
Is it possible to give a sql query in the from clause befor the giving a table name.
for instance:-
select top 1 Salary from(select top 2 Salary from sstable order by Salary desc) aas
it is working but
my question is what is happening here
Whether a table is created virtually in the name aas
Loading
Venkatesan JayakanthamPosted Jun 6, 2010, 9:42 PM
Cheers,
Venkatesan Prabu .J
http://venkattechnicalblog.blogspot.com/
DRISHTYPosted May 24, 2010, 9:18 AM
Select query in from clause is called derived table.
They are created on the fly and then use these derived tables within your query. In very basic terms, a derived table is a virtual table that's calculated on the fly from a select statement.
In concept this is similar to creating a temporary table and then using the temporary table in your query, but the approach is much simpler, because it can all be done in one step.