MySQL Forums
Forum List  »  Stored Procedures

To simplify it is to insert or update in table1 of table2 and table3
Posted by: RADE MIH
Date: June 20, 2018 04:32AM

apologize for my English, I'm a beginner ..
To simplify it is to insert or update in table1 of table2 and table3. If table 1 does not provide an account then insertconto and the amount, if there is an account then update the previous amount = the previous amount + amount.
If there is no account in the table2, the partner and the item then insert the account, the parner, the item and the amount if there are then update the previous amount = the previous amount - the amount.
In table3, if there is no account, partner, item then insert account, partner, item and amount, but if there are then only update amount, if the previous amount> 0 then the previous amount = the previous amount + amount, otherwise the previous amount = the previous amount - the amount.
table1 has account (primary key), amount.
table2 has an account, a partner, an item, an amount. account, partner, item are primary keys.
abela3 has an account, a partner, an item, an amount. account, partner, item are primary keys.
In the form I accept wkonto, wpartner, wstavka, wiznos corresponding to the names in the database I just added w to know that it is entered through the form.
I would like to put all this into a procedure that would involve commit and rolback, I think it would work so fast and safer this way.

Options: ReplyQuote


Subject
Views
Written By
Posted
To simplify it is to insert or update in table1 of table2 and table3
1052
June 20, 2018 04:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.