mercredi 6 juillet 2016

Update error in postgres SQL


CREATE TRIGGER INSERT_salesorderdetail
before insert on salesorderdetail
for each row 
UPDATE customer
set number_of_items=IFNULL(number_of_items,0)+1
where new.customerid=customer.customerid;

I have 2 tables salesorderdetail and customer and i want each time i inserts a new item in salesorderdetail to update my columne in customer the number_of_items but for some reason i get a syntax error in update.


Aucun commentaire:

Enregistrer un commentaire