sql >> Database >  >> RDS >> Mysql

FOUT #1054 - Onbekende kolom 'program_id' in 'NIEUW

MAAK TRIGGER trig_job_color NA INSERT OP tb_jobs BEGIN VOOR ELKE RIJ @program_id =(Selecteer program_id van tb_ticketswhere tb_tickets.job_id =NEW.job_id);

SET @newstatus = (Select status from tb_tickets
where tb_tickets.job_id = NEW.job_id);
SET @newsite_id = (Select site_id from tb_tickets
where tb_tickets.job_id = NEW.job_id);

CASE @program_id
 WHEN 1 THEN
   UPDATE tb_sites_3 
   SET tb_sites_3.color_status = @newstatus 
   WHERE tb_sites_3.site_id = @newsite_id;
 WHEN 2 THEN
   UPDATE tb_sites_3 
   SET tb_sites_3.color_status = @newstatus 
   WHERE tb_sites_3.site_id = @newsite_id;
 WHEN 3 THEN
   UPDATE tb_sites_3
   SET tb_sites_3.color_status = @newstatus 
   WHERE tb_sites_3.site_id = @newsite_id;
 END CASE;
 END


  1. Geo-zoeken (afstand) in PHP/MySQL (prestaties)

  2. SQL LIKE-operator voor beginners

  3. SELECT max(x) retourneert null; hoe kan ik ervoor zorgen dat het 0 teruggeeft?

  4. .nextval JDBC invoegprobleem