lundi 13 juillet 2015

SQLite Trigger for Inserting values from different tables

I would like to create a trigger on SQLite to update one table with values from more than one table. I have tried the code below but navicat for Sqlite wont save my trigger. Could someone help?

BEGIN
INSERT INTO hdClassSet (setNo, class, type, regdate, acYear)
      VALUES (((SELECT max(setNo) FROM hdClassSet)+1), 
              old.clID,
              0,  
              (date('now','localtime')),
              (SELECT acID FROM tblAcad WHERE actv1=1));
END

I managed to save and test the trigger without the last value and it works. How can I reference another table that does not start or affected by the trigger? I will be grateful!

Aucun commentaire:

Enregistrer un commentaire