Is this what you are trying to do:
Hi, I've got two database tables and I'm trying to remove records from the first table that match a value in the second table.
If that's the case, it sounds like what you need is a SQL join. For instance: (untested SQL code)
SELECT foo_id
FROM foo, bar
WHERE paco < (waco + 10)
AND paco > (waco - 10)
Here's the steps to take:
- using DBI, run a SELECT SQL statement returning a result set based upon a JOIN of the two tables.
- Going through each value in the record set, run a DELETE of the records that you want to remove.
I bet that there are some SQL gods out there who could do it through a single SQL statement, but for me SQL delete statements that complex give me the jitters.
()-()
\"/
`
|