Azu Posted August 21, 2007 Share Posted August 21, 2007 Hi, can somebody please tell me how to fix my query? update `Table` set `PreviousID`=(select `ID` from `Table` where `NextID`=`Table`.`ID`) For some reason it is giving me this weird error; Error Code : 1093 You can't specify target table 'Table' for update in FROM clause Link to comment https://forums.phpfreaks.com/topic/65894-error-cant-specify-table/ Share on other sites More sharing options...
Illusion Posted August 21, 2007 Share Posted August 21, 2007 you cannot update a table and select from the same table in a subquery, MySQL currently not suppoprting that. Link to comment https://forums.phpfreaks.com/topic/65894-error-cant-specify-table/#findComment-329510 Share on other sites More sharing options...
Azu Posted August 21, 2007 Author Share Posted August 21, 2007 Okay.. please show me the right way to do this then.. I'm new to subqueries :-/ Link to comment https://forums.phpfreaks.com/topic/65894-error-cant-specify-table/#findComment-329762 Share on other sites More sharing options...
Illusion Posted August 21, 2007 Share Posted August 21, 2007 create a temporary table and go ahead............ Link to comment https://forums.phpfreaks.com/topic/65894-error-cant-specify-table/#findComment-329812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.