我有一个输出当前数据的现有查询,我想将其插入到Temp表中,但是这样做有一些问题。有人会对如何执行此操作有一些见解吗?
这是一个例子
SELECT * FROM (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) data WHERE application LIKE isNull('%MORESTUFF%', '%')
这似乎当前以我需要的方式输出我的数据,但我想将其传递到临时表中。我的问题是我对SQL查询还很陌生,还没有找到一种方法来做到这一点。或者,即使有可能。如果不可能,是否有更好的方法将我要查找的数据获取WHERE application LIKE isNull('%MORESTUFF%','%')到临时表中?
WHERE application LIKE isNull('%MORESTUFF%','%')
SELECT * INTO #Temp FROM (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) data WHERE application LIKE isNull( '%MORESTUFF%', '%')