CodeIgniter Forums
Need help with Delete query - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Need help with Delete query (/showthread.php?tid=34206)



Need help with Delete query - El Forum - 09-22-2010

[eluser]Leftfield[/eluser]
Hello! I need remove node with it all comments, first of all i made select query with JOIN:

Quote:SELECT * FROM pages as t1 LEFT JOIN comments as t2 ON t1.id=t2.entry_id WHERE t1.id = '1';
I dont know how to delete this selection


Need help with Delete query - El Forum - 09-22-2010

[eluser]danmontgomery[/eluser]
Code:
DELETE FROM pages, comments USING pages LEFT JOIN comments ON comments.entry_id = pages.id WHERE pages.id = 1;



Need help with Delete query - El Forum - 09-22-2010

[eluser]Leftfield[/eluser]
[quote author="noctrum" date="1285201489"]
Code:
DELETE FROM pages, comments USING pages LEFT JOIN comments ON comments.entry_id = pages.id WHERE pages.id = 1;
[/quote]
THANK YOU +5