ive got the following sql for my MySQL database using PHP scripting:
DELETE cartcontents.*, sid.sid_sid
FROM sid RIGHT JOIN cartcontents ON sid.sid_sid = cartcontents.carsid
WHERE sid.sid_sid Is Null
I want it to delete records in the table named 'cartcontents' where another record does not exist in the 'sid' table and it doesnt work.
If i replace the 'DELETE' in the above sql, it will display all the correct records that i wish to delete fine without errors, but how do i turn the select query into a delete query? simply replaceing the 'SELECT' with 'DELETE' doesnt work as you can see above, it gives me errors.
The error i get is: 1064-You have an error in your SQL syntax near 'cartcontents.*, sid.sid_sid FROM sid RIGHT JOIN cartcontents ON sid.sid_sid = ca' at line 1
Ive been trying for an hour now to make it work but get the same error, thing is, it will work as a select query no worries, ive eventried it in an access database and the delete query works fine.
Can anyone tell me what im doing wrong?
DELETE cartcontents.*, sid.sid_sid
FROM sid RIGHT JOIN cartcontents ON sid.sid_sid = cartcontents.carsid
WHERE sid.sid_sid Is Null
I want it to delete records in the table named 'cartcontents' where another record does not exist in the 'sid' table and it doesnt work.
If i replace the 'DELETE' in the above sql, it will display all the correct records that i wish to delete fine without errors, but how do i turn the select query into a delete query? simply replaceing the 'SELECT' with 'DELETE' doesnt work as you can see above, it gives me errors.
The error i get is: 1064-You have an error in your SQL syntax near 'cartcontents.*, sid.sid_sid FROM sid RIGHT JOIN cartcontents ON sid.sid_sid = ca' at line 1
Ive been trying for an hour now to make it work but get the same error, thing is, it will work as a select query no worries, ive eventried it in an access database and the delete query works fine.
Can anyone tell me what im doing wrong?