Lynn Pettis (3/17/2013)
Really, CTEs are complex? I find them to make writing queries easier as you don't have to write derived tables.
🙂
Let's compare:
;WITH MyData AS (
SELECT TOP 2 *
FROM dbo.NFFeeds
ORDER BY id DESC
)
SELECT * FROM MyData
ORDER BY id
VS.
SELECT * FROM (
SELECT TOP 2 *
FROM dbo.NFFeeds
ORDER BY id DESC) MyData
ORDER BY id
Derived table wins as it does not contain extra words ";WITH MyData AS ".
Apparently, CTE's are more complex comparing to derived tables.
😎
_____________
Code for TallyGenerator