Martijn Tonies wrote:
What is the exact error message?


Here's the latest query:

delimiter //
create trigger jobposts_control
 before delete on jobposts for each row
begin
   declare dummy varchar(255);
   set @counted = (
       select count(ad.adsource_id)
       from adsource ad, jobposts jp
       where ad.adsource_id = jp.adsource_id
       and old.jobpost_id = jp.jobpost_id
   );
   if @counted >= 1 then SET dummy = "Cannot delete this record"; end if;
end //
delimiter ;

Here's the error message:

ERROR: Unknown column 'old.jobpost_id' in 'where clause'

Query
= set @counted = (
       select count(ad.adsource_id)

      from adsource ad, jobposts jp
       where ad.adsource_id
= jp.adsource_id
       and old.jobpost_id = jp.jobpost_id

  )

It looks like I can't do what I want to do . . . get the jobpost_id to check jobpost and adsource tables BEFORE proceeding to delete the record. If so, what's the best way to do this?

--
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]

Reply via email to