There are two tables (notifAlarmlog and rhic_au_fy_01)in a
Sybase Db. The fields are , seperated. The names above the
data are the column titles. The program here counts (total
number of alarms, those <2 secs., those =>2 and <10 secs., and those
>10 secs). Now I have to use the info from the second table
(rhic_au_fy_01) to filter out the alarms in notifLogTable
that occur w/in 10 secs. of a Quench Event (ev-yquench or ev-bquench). | [reply] |
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.
()-()
\"/
`
| [reply] [d/l] |