Friday, December 16, 2011

When life gives you lemons:
mysql> update tasks set task_department = (select project_department  from tasks AS t, projects where project_id = task_project);
ERROR 1093 (HY000): You can't specify target table 'tasks' for update in FROM clause
Solution:
UPDATE tasks AS t INNER JOIN projects AS p ON t.task_project = p.project_id SET t.task_department = p.project_department;

No comments: