A
Anonymous
Guest
ive got the following sql for my 3.23.51 MySQL database using PHP scripting, ive tried several combinations below and none work:
DELETE cartcontents.*, sid.sid_sid
FROM sid RIGHT JOIN cartcontents ON sid.sid_sid = cartcontents.carsid
WHERE sid.sid_sid Is Null
DELETE FROM cartcontents.*
sid RIGHT JOIN cartcontents ON sid.sid_sid = cartcontents.carsid
WHERE sid.sid_sid Is Null
DELETE FROM cartcontents
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 with 'SELECT', 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 replacing 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? Is it that mysql does not support this 2 table delete query?
DELETE cartcontents.*, sid.sid_sid
FROM sid RIGHT JOIN cartcontents ON sid.sid_sid = cartcontents.carsid
WHERE sid.sid_sid Is Null
DELETE FROM cartcontents.*
sid RIGHT JOIN cartcontents ON sid.sid_sid = cartcontents.carsid
WHERE sid.sid_sid Is Null
DELETE FROM cartcontents
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 with 'SELECT', 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 replacing 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? Is it that mysql does not support this 2 table delete query?