Insert Data Into Temp Table with Query

scapegoat17

I have an existing query that outputs current data, and I would like to insert it into a Temp table, but am having some issues doing so. Would anybody have some insight on how to do this?

Here is an example

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%', '%') 

This seems to output my data currently the way that i need it to, but I would like to pass it into a Temp Table. My problem is that I am pretty new to SQL Queries and have not been able to find a way to do so. Or if it is even possible. If it is not possible, is there a better way to get the data that i am looking for WHERE application LIKE isNull('%MORESTUFF%','%') into a temp table?

Yosi Dahari
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%',
      '%')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Insert query results into temp table

From Dev

insert data from xml column into temp table

From Dev

How to insert data into temp table from a string

From Dev

Inserting data into a temp table from an open query

From Dev

Pad 0's to returned query and insert into temp table

From Dev

Insert dynamic query results into un-defined temp table?

From Dev

MySQL Temp table Insert

From Dev

Insert into a Temp Table in a CTE

From Dev

SQL insert #TEMP table

From Dev

How to insert data to temp Table in stored procedure with another procedure?

From Dev

Send csv data to stored procedure and insert into #temp table

From Dev

select data from #Temp table after #temp table create in another query in asp.net c#

From Dev

insert duplicate rows in temp table

From Dev

Insert result into temp table mariadb

From Dev

Insert Variable Into Temp Table Field

From Dev

insert duplicate rows in temp table

From Dev

Insert data from a table to a temporary table, and then select from the temp table specific rows

From Dev

MySQLdb/Python INSERT query not inserting data into table

From Dev

building a dynamic query to insert data into table

From Dev

SQLITE Query results into a temp table

From Dev

Mysql select query with temp table

From Dev

Mysql select query with temp table

From Dev

How to insert into a table from temp table?

From Java

TSQL Insert N into fixed temp table

From Dev

How to insert into an existing temp table in SQL Server

From Dev

How to insert multiple select statements into a temp table

From Dev

bulk insert into temp table from a text file

From Dev

Stored Procedure not working with insert into temp table

From Dev

Case Select Then Insert Into Temp Table not working

Related Related

HotTag

Archive