我有一个 CTE 表结果需要插入到临时表中,并且我需要稍后将其用于连接目的。我有类似的查询需要转换为 sql Kata
我的查询是这样的
` 将@tempTable 声明为 table(column1 int, column2 nvarchar(100), column3 nvarchar(100));'
WITH CTE AS(SELECT t1.column1, t1.column2 from table1 t1 where t1.column1 ="column1" union All SELECT t2.column1, t2.column2 from table1 t1 as t2 inner join CTE AS c on c.column1 = t2.column1 insert into @tempTable select distinct * from CTE cc left outer join( select * from view1 tv,view2 tc where ta.colum1 = tc.colum1) tr on condition1=condition left outer join( select * from view1 tv,view2 tc where ta.colum1 = tc.colum1) tr on condition1=condition select * from @tempTable
由于我无法共享架构详细信息,所以我想知道如何使用 sqlKATA 将 cte 结果存储在临时表中