i have feedback table contains user feedbacks , ratings per entity. there cases in multiple users have voted on same entity not desirable , have entered system due glitch.
the table schema this:
qa_id,int(10) //id of entity score,smallint(1) user_id,int(3) feed_time,datetime
i trying delete 1 of duplicate entries (fortunately there 1 feedback) query:
delete feedback md5(qa_id+feed_time) in ( select md5(qa_id+feed_time)from feedback fb group fb.qa_id having count(fb.qa_id) > 1 order fb.qa_id desc )
it fails saying:
error code : 1093 can't specify target table 'feedback' update in clause (0 ms taken)
that cannot select , delete same table (i.e. if appears in sub-query). don't have expertise in databases , not allowed use programming language same. :(
any suggestions on how can queries only?
the easiest way fix in mysql put subquery in additional layer of subquery:
delete feedback md5(qa_id+feed_time) in (select * (select md5(qa_id+feed_time) feedback fb group fb.qa_id having count(fb.qa_id) > 1 ) t )
Comments
Post a Comment