SELECT distinct categoryID, category FROM #variables.tableprefix#categories WHERE projectID = AND categoryID = AND type = ORDER BY category INSERT INTO #variables.tableprefix#categories (projectID,categoryID,type,category) VALUES (, '#newID#', , ) UPDATE #variables.tableprefix#categories SET category = WHERE categoryID = DELETE FROM #variables.tableprefix#categories WHERE categoryID =