Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Usage of CTE in a nested select

$
0
0

Hi,

Im very new to CTE. I have a nested select statement for CTE like the one below but i keep hitting this error:

Msg 1033, Level 15, State 1, Line 13

The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.


With t as

(select distinct N from listofnumbers)

select nums.h, nums.m

from (select N/60/60 as H, (N/60)%60 as M from t order by N) as nums

How to I query the CTE defined?


cherriesh


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>