Charles Tester Charles Tester - 5 months ago 6
SQL Question

MySql Delete not working

I have a mysql delete script which gives me an 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 'LEFT JOIN mall ON mall.m_id = unifo.mids WHERE mallnames = 'My Mall'' at line 2


Delete query:

DELETE FROM unifo
LEFT JOIN mall ON mall.m_id = unifo.mids
WHERE mallnames = 'My Mall' && time_insert < NOW( ) - INTERVAL 25
MINUTE


I cannot find my mistake

Answer

you have a basic issue in this query

DELETE FROM unifo 
LEFT JOIN mall ON mall.m_id = unifo.mids 
WHERE mallnames = 'My Mall' && time_insert < NOW( ) - INTERVAL 25 
MINUTE

your performing a left join with mall table and then base on mall value your going to delete something but in left join mallname can be null no point of left joining it

2 specify the table

DELETE unifo FROM unifo ....