我有输出当前数据的现有查询,我想插入它Temp但这样做有一些问题。有人会对如何执行这个操作有一些看法吗?( r# a" U4 h5 ~% i# e0 i S
这是一个例子# F- l5 S% J2 U
SELECT *FROM (SELECT Received, Total, Answer, CASE WHEN application LIKE '%STUFF%' THEN 'MORESTUFF END ) AS application FROM FirstTable WHERE Recieved = AND application = 'MORESTUFF GROUP BY CASE WHEN application LIKE '%STUFF%' THEN 'MORESTUFF END) dataWHERE application LIKE isNull('%MORESTUFF%,目前,我似乎以我需要的方式输出我的数据,但我想将其传输到临时表。我的问题是我对SQL查询还是很奇怪的,还没有找到办法做到这一点。或者,即使有可能。如果不可能,有没有更好的方法获取我想找到的数据?WHEREapplication LIKE isNull('%MORESTUFF在临时表中,%'''?% ^ H R2 i) K) D2 e& Y
, A. H* m0 \6 { f" ^解决方案: : p# x9 `3 p* x SELECT *INTO #TempFROM (SELECT Received, Total, Answer, (CASE WHEN application LIKE '%STUFF%' THEN 'MORESTUFF' END) AS application FROM FirstTable WHERE Recieved = 1 AND application = 'MORESTUFF' GROUP BY CASE WHEN application LIKE '%STUFF%' THEN 'MORESTUFF' END) dataWHERE application LIKE isNull( MORESTUFF