Re: Php - Mysql recursive deletion question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



DELETE content_data, content_file
FROM content_data, content_file, content
WHERE content_data.id_content = content.id_content AND
content_file.id_content_data = content.id_content_data AND
content.id_section = 5;

the SQL syntax above will (hopefully) delete all rows on content_data
and content_file which match with content.id_section = 5.

can you try the SQL command and post the result?

note: as i didn't follow this thread from the beginning and i don't know
the structure of your tables, so i assume that table content are the
parent table which has the id (primary key) of content_data and
content_file table.

>>> Hi, i have 3 tables:
>>> * content
>>> * content_data
>>> * content_file
>>>
>>> content has an ID called: id_section
>>> content_data has an ID called: id_content content_file has an ID called:
>>> id_content_data
>>>
>>> 1) I need to DELETE all the records from content_file that are
>>> vinculated to the records from content where id_section=5
>>>
>>> 2) I need to DELETE all the records from content_data that are
>>> vinculated to the records from content where id_section=5
>>>
>>> Can (1) or (2) be executed from one SQL sentence?
>>> So far I have this code, but it takes A LOT of innecesary resources.


-- 
Markus
------------------------------
RevTI Web Hosting
http://www.revti.com
------------------------------



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux