I recently learned about recursive common table expressions (CTEs), looking for a way to create a specific representation of some data. After taking time to write how the first iteration of my query will work, I turned it into a CTE to see how it all happens. I was surprised to see that the grouping is not working, so I just replaced it with the equivalent of “Select TOP 1, ORDER BY”. I was again surprised that the “TOP” was not allowed, and came to the conclusion that all these provisions are not allowed in the recursive part of the CTE:
So, I have 2 questions:
.
: -
SQL, ?
CTE, CTE , , SELECT, INSERT, UPDATE DELETE.
SELECT
INSERT
UPDATE
DELETE
CTE , SELECT CTE , . . " CTE" MSDN
, CTE , , , SELECT, INSERT, UPDATE DELETE, , CTE .
2. - , , ?
, , , , , , view/ CTE select. . GROUP BY CTE ,
GROUP BY
, , , .
Source: https://habr.com/ru/post/1768941/More articles:GPS usage example in AIR - airHow to get sql queries when a trigger starts, up to n levels? - listSQL core - sqlWhat is the use of the Union of All? - sqlhow to change ace2editor etherpad to something else? - javascriptType confusion - javascriptC # / LINQ: how to query this XML structure - c #CakePHP: how to read user data in a session? - databaseCan you make sure all threads are running with a specific culture? - multithreadingразмещение наименьшего по величине целого числа - c#All Articles