sql - Can I use WITH in TSQL twice to filter a result set like my example? -


I need to do something like this but SQL Server 2008 does not like it, my query is actually more complex than this and I know that this is not the best way to accomplish what I am doing, but my focus is on the functionality of the bone statement, not selection and where the statements.

with the name of the item (name, start, id1) with the name (start name, start, id from employee where startg> 0)

Select)

Select * From Content 2 where id> 10

I do this all the time:

with luggage (select accessories, start, employee starts from where-> 0), luggage 2 AS (select name, start-up, luggage from luggage 1) Select * WHERE ID from luggage & gt; 10

As far as I can tell, I could not reach a limit in CTE.

The only thing you can not do that (which would be very helpful) is to separate the CTE with the form of stuff with SELECT s:

  (Selector name, start, where employee started from & gt; 0), select accessories 2s (selection name, start date, luggage from luggage 1) * accessories from WHERE id & gt; 10; SELECT * to luggage 2 WHERE id & lt; 10  

Say instead you will have to copy and paste the entire CTE series.


Comments