I'm trying to run this MYSQL command:
DELETE FROM hotel h
LEFT JOIN user_hotel uh ON h.hotel_id = uh.hotel_id
WHERE uh.user_hotel_id IS NULL
It is returning this error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'h LEFT JOIN user_hotel uh ON h.hotel_id = uh.hotel_id WHERE uh.user_hotel_id I' at line 1
The command seems self-explanatory, so not sure what I'm getting wrong. Any ideas?
you are missing table_name those you want to delete
DELETE h FROM hotel h
LEFT JOIN user_hotel uh ON h.hotel_id = uh.hotel_id
WHERE uh.user_hotel_id IS NULL
You need to provide the table name which you want to delete like
DELETE h FROM hotel h
LEFT JOIN user_hotel uh ON h.hotel_id = uh.hotel_id
WHERE uh.user_hotel_id IS NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With