I'm trying to move enums from a table into their own table, the easiest way would be to run an SQL query which I figured I might use a WHILE loop for, but having never used one before the below obviously doesn't work. Is it possible to do something as the following:
WHILE (SET @cat = (SELECT DISTINCT `category` FROM `tablename`))
DO
BEGIN
INSERT INTO `categories` (title) VALUES (@cat);
END;
END WHILE;