Create a temporary table from another table

How do I create a temporary table from another table and display the new table?
I'm trying this, but I get, "4184 rows affected by the last command, no resultset returnet".

CREATE TEMPORARY TABLE _temptable
SELECT _itemroot AS 'ITEM ROOT',
CASE WHEN _umex = 'FT' THEN (1 + 0)
WHEN _umex = 'LB' THEN (1 + 1)
WHEN _umex = 'EA' THEN (1 + 2)
ELSE 'No UM' END AS 'YIELD'
FROM tbl_tnlrpts
WHERE _workcenter = 'EXTPACK' AND _date BETWEEN '2008-03-30' AND '2008-03-30'
ORDER BY _itemroot
LVL 13
RickAsked:
Who is Participating?
 
UmeshConnect With a Mentor MySQL Principle Technical Support EngineerCommented:
Here is the solution for your problem.......... :-)

http://www.experts-exchange.com/Database/MySQL/Q_23915202.html
0
 
Terry WoodsIT GuruCommented:
I'm used to using this syntax:
SELECT _itemroot AS 'ITEM ROOT',
CASE WHEN _umex = 'FT' THEN (1 + 0)
WHEN _umex = 'LB' THEN (1 + 1)
WHEN _umex = 'EA' THEN (1 + 2)
ELSE 'No UM' END AS 'YIELD'
FROM tbl_tnlrpts
WHERE _workcenter = 'EXTPACK' AND _date BETWEEN '2008-03-30' AND '2008-03-30'
ORDER BY _itemroot
into temp _temptable

Open in new window

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>I'm trying this, but I get, "4184 rows affected by the last command, no resultset returnet".
that's normal, you CREATE the table (step 1), and then, in a second statement, you need to query that table.
0
 
RickAuthor Commented:
angelIII,

OK. I ran the first query, then "SELECT * FROM _temptable;", but I got, "Table 'db_tnlrpts._temptable' doesn't exist."

Thanks,
Rick
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.