can you not use referential integrity for this - assuming the tables are or can be made to be innodb?
Does the jobposts table have a jobpost_id field, or is it just "id"? Maybe it's a typo? On Fri, Dec 5, 2008 at 11:28 AM, Lola J. Lee Beno <[EMAIL PROTECTED]> wrote: > David Giragosian wrote: > >> >> I'm no expert, but 'old' is a table, I'm guessing, and it isn't >> referenced in the 'from' clause of the query. >> could it be that simple...? David >> >> > > No . . . 'old' is a virtual table that is the same as the table I'm doing > work on. See <http://dev.mysql.com/doc/refman/5.0/en/trigger-syntax.html>. > What I need to do is check if jobposts record has jobposts.adsource_id > (foreign key) which still exists in adsource table (primary key). If > adsource record still exists, then do not proceed with deleting jobpost > record - that's what I'm trying to do and thus is what this trigger is > supposed to do. > > > > -- > Lola J. Lee Beno - ColdFusion Programmer/Web Designer for Hire > http://www.lolajl.net/resume | Blog at http://www.lolajl.net/blog/ > "In rivers, the water that you touch is the last of what has passed > and the first of that which comes; so with present time." - Leonardo da > Vinci (1452-1519) > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- Jim Lyons Web developer / Database administrator http://www.weblyons.com