I am running the following query:
SELECT *
INTO consolidated
FROM (SELECT qtyAvailable
FROM Inventory
UNION ALL
SELECT revenue,
location,
qtySold
FROM sales
UNION ALL
SELECT inactive,
new,
itemNum,
category,
subCategory,
color,
FROM Masterlist) n
And get these errors
Error
SQL query: Documentation
SELECT *
INTO consolidated
FROM (SELECT qtyAvailable
FROM Inventory
UNION ALL
SELECT revenue,
location,
qtySold
FROM sales
UNION ALL
SELECT inactive,
new,
itemNum,
category,
subCategory,
color,
FROM Masterlist) n
LIMIT 0, 25
MySQL said: Documentation
#1327 - Undeclared variable: consolidated
and when I remove the new table or "variable" this error
Error
SQL query: Documentation
SELECT *
FROM (SELECT qtyAvailable
FROM Inventory
UNION ALL
SELECT revenue,
location,
qtySold
FROM sales
UNION ALL
SELECT inactive,
new,
itemNum,
category,
subCategory,
color,
FROM Masterlist) n
LIMIT 0, 25
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM Masterlist) n
LIMIT 0, 25' at line 16
And when I remove the n, the similar error
Error
SQL query: Documentation
SELECT *
FROM (SELECT qtyAvailable
FROM Inventory
UNION ALL
SELECT revenue,
location,
qtySold
FROM sales
UNION ALL
SELECT inactive,
new,
itemNum,
category,
subCategory,
color,
FROM Masterlist)
LIMIT 0, 25
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM Masterlist)
LIMIT 0, 25' at line 16
I am not deeply experienced with myPHP , but basically I am running a query on three tables in a database, and I want to insert the results in a new table, which I am calling consolidated. I created the consolidated table and left the columns empty. I do not know where to begin, thanks in advance for any help! Also I came up with the initial query based on this post