Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Deleting data from two tables simultaneously
#1

[eluser]theshiftexchange[/eluser]
Hi everyone,

How do I use active records to delete multiple records across two tables with a one to many relationship in the following scenario?

I have table 1 with a list of "ads". Each ad has a unique "ad_ID" and a "date".

I have table 2 with a list of stuff for the ad, with it having many items for one "ad_ID".

So if I decide to delete all "ads" from table 1 older than a certain date, I need it to delete any corresponding items from table 2 with all the "ad_ID" that just got deleted.

I'm thinking I need some sort of join function? Do joins allow you to delete data across tables?


Messages In This Thread
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 01-21-2011, 12:14 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 01-21-2011, 08:05 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 01-22-2011, 06:29 PM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 01-24-2011, 08:14 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 01-24-2011, 08:12 PM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 01-25-2011, 07:04 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 01-25-2011, 10:08 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 02-17-2011, 06:13 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 03-14-2012, 02:59 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 03-14-2012, 03:37 AM
[SOLVED] Deleting data from two tables simultaneously - by El Forum - 06-05-2013, 07:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB