When I run the code below inside phpmyadmin I get an error "Undefined Variable tmpportfolio"
what is the problem?
SQL:
CREATE TEMPORARY TABLE tmpportfolio (p_name VARCHAR(255),portfolio_id INT UNSIGNED NOT NULL);
SELECT p_name, portfolio_id INTO tmpportfolio
FROM portfolio
WHERE parent_portfolio_id IS NULL
AND portfolio_id NOT IN
(
SELECT x.parent_portfolio_id
FROM portfolio x
WHERE x.parent_portfolio_id IS NOT NULL
)
AND account_id = 1
SELECT * FROM tmpportfolio;