delimiter $$
CREATE TRIGGER REDUCE_NOTE_COUNT
AFTER DELETE ON iv_notes
FOR EACH ROW BEGIN
DECLARE supplierid int(11);
DECLARE customerid int(11);
SELECT supplierid ,customerid FROM iv_documents WHERE id=OLD.note_documentid;
SET supplierid=supplierid;
SET customerid=customerid;
IF supplierid=OLD.note_companyid THEN
update iv_documents
set supplier_notes=supplier_notes-1
where id=OLD.note_documentid and supplier_notes>0;
END IF;
IF customerid=OLD.note_companyid THEN
update iv_documents set customer_notes=customer_notes-1
where id=OLD.note_documentid
and customer_notes>0 ;
END IF;
END$$
डिलीमीटर से परिणामसेट वापस करने की अनुमति नहीं है;को एक ट्रिगर mysql
नया उपयोगकर्ता टिप: कृपया, लोग, सवाल पूछें, यह स्पष्ट नहीं है कि आप क्या पूछ रहे हैं। आपके द्वारा उपयोग किए जाने वाले संस्करण को शामिल करें, और संभवतः एक त्रुटि संदेश :) –