I have two tables, one has a relational column to the other. I need to insert Total quantity of items from the ItemTable with the same itemCode into the TotalQuantity table. The column ItemID in the TotalQuantity table holds the value of the ID of a given item. However I have trouble inserting as I do not know the correct syntax. Thanks in advance for your help.
createItemTable = "CREATE TABLE ItemTable "
+ "(ID INT NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "
+ "ItemCode INTEGER, "
+ "Quantity INTEGER, "
+ " )";
createTotalQuantityTable = "CREATE TABLE TOTALQUANTITY " +
"(ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY," +
"TOTALQUANTITY INTEGER," +
"ITEMID INTEGER NOT NULL REFERENCES ITEMTABLE (ID)," +
"PRIMARY KEY (ID))";