SQL Nested Queries - TechRepublic
General discussion
January 5, 2010 at 07:18 AM
dpcarlton

SQL Nested Queries

by dpcarlton . Updated 16 years, 6 months ago

Hi…

I am trying to do a SQL nested query where like following:

Select * FROM (SELECT TOP 23 PERCENT convert(varchar,cast(dateCommInstalled as datetime),10) AS dateCommInstalled, COUNT(retNum) AS countofretnum, Row_Number() Over (order by dateCommInstalled ASC) as row FROM TABLE1 BY dateCommInstalled HAVING (dateCommInstalled IS NOT NULL) ORDER BY cast(dateCommInstalled as datetime)) order by datecomminstalled DESC

But, SQL (2005) does like this sort of nested query. What I trying to do is basically get a set of results, sorted in DESC order, then reverse the order.

Any help is appreciated.

Dan

This discussion is locked

All Comments