create trigger mysql why this is not work?? i want if i'm insert to this table the table in before i'm insert get decrement....

CREATE TRIGGER prosesqc2
AFTER INSERT ON quality2
FOR EACH ROW 
BEGIN
INSERT INTO stock_barang 
SET  idbarang = NEW.idbarang, 
     lolos_qc_sfl=New.terima, 
     dalam_proses=new.terima
ON DUPLICATE KEY 
UPDATE lolos_qc_sfl=lolos_qc_sfl+New.terima 
   and dalam_proses=dalam_proses-new.terima;
END
why this is not work??



Wrong and in UPDATE section, comma needed; 
The trigger contains single statement, so BEGIN-END block is excess.

CREATE TRIGGER prosesqc2
AFTER INSERT ON quality2
FOR EACH ROW 
INSERT INTO stock_barang 
    SET  idbarang     = NEW.idbarang, 
         lolos_qc_sfl = NEW.terima, 
         dalam_proses = NEW.terima
ON DUPLICATE KEY 
UPDATE lolos_qc_sfl = lolos_qc_sfl + NEW.terima, 
       dalam_proses = dalam_proses - NEW.terima;