Need help with this sql command.
Tables:
category ( category, id_category, salary, year)
oldcategory ( year, category, salary )
How could I get the data on oldcategory and insert it into category while creating at the same time a number id for each different category on id_category
?
INSERT INTO category(category, id_category, salary, year)
SELECT DISTINCT category, () , salary, year
FROM oldcategory
WHERE category IS NOT NULL AND salary IS NOT NULL AND year IS NOT NULL