If the tables are InnoDB, you could temporarily set up a foreign key
relationship between the two, with the 'ON DELETE CASCADE' option. 

On Tue, 2008-07-08 at 11:14 -0400, Jeff Mckeon wrote:
> I think this is possible but I'm having a total brain fart as to how to
> construct the query..
> 
> Table2.ticket = table1.ID
> 
> Table2 is a many to 1 relationship to table1
> 
> I need to delete all records from table1 where created <
> unix_timestamp(date_sub(now(), interval 3 month)) 
> And all rows from table2 where Table2.ticket = Table1.ID (of the deleted
> rows..)
> 
> Can't this be done in one query? Or two?
> 
> Thanks,
> 
> Jeff
> 
> 
> 
> 
-- 
Ian Simpson
System Administrator
MyJobGroup

This email may contain confidential information and is intended for the 
recipient(s) only. If an addressing or transmission error has misdirected this 
email, please notify the author by replying to this email. If you are not the 
intended recipient(s) disclosure, distribution, copying or printing of this 
email is strictly prohibited and you should destroy this mail. Information or 
opinions in this message shall not be treated as neither given nor endorsed by 
the company. Neither the company nor the sender accepts any responsibility for 
viruses or other destructive elements and it is your responsibility to scan any 
attachments.

Reply via email to