我有两个脚本,一个用于插入,另一个用于更新。MySQL更新语句错误
我的更新按钮脚本是采用了最新的插入的标识,并继续是这样的:
Update tblsurvey
set WouldLikeToBeSeenOnSite = 'sadffas'
and DislikedOnSite = 'asdfsadfsadf'
and OtherNewsWebsitesRead = 'asdfsadfa'
and LikedOnOtherNewsSites = 'asdfsadfas'
and IPAddress = '172.16.0.123'
and DateAnswered = current_date()
where SurveyResponseId in (select max(SurveyResponseId) from tblsurvey);
显然,“where”子句产生一个错误:
1093 - you cant specify target table 'tblsurvey' for update in FROM clause.
有什么其他方式,我可以使用我正在更新的同一张表的最新插入ID?
谢谢。
好吧,因为我无法做任何事情,我决定只是创建另一个sp得到最后插入的ID ..谢谢无论如何。 :) – iceheaven31 2010-11-02 08:45:59