mysql - Delete query with inner join -
query
delete `contact` `contact` ct inner join `contact_user` cu on cu.contact_id=ct.id ct.id=4 && ct.block_id=5671 && cu.user_id=1
error
fatal: sqlstate[42s02]: base table or view not found: 1109 unknown table 'contact' in multi delete; sql: delete
contact
contact
ct inner joincontact_user
cu on cu.contact_id=ct.id ct.id=4 && ct.block_id=5671 && cu.user_id=1
since have defined alias name
table contact
need use alias name instead of original table name. try this
delete ct contact ct inner join contact_user cu on cu.contact_id = ct.id ct.id = 4 , ct.block_id = 5671 , cu.user_id = 1
or remove alias name contact
table
delete contact contact inner join contact_user cu on cu.contact_id = contact.id contact.id = 4 , contact.block_id = 5671 , cu.user_id = 1
Comments
Post a Comment