I have a trigger that logs the customer order changes in a table. I shall, for each row in the log table to figure out how much the value has changed. I have three columns to be used, quantity, price and discount.
In the table, the three columns like this:
old_price, new_price, old_qty, new_qty, old_discount, new_discount.
Everything works except that I do not get into how I can calculate the amount of change per row. Each entry in the table is logged in the field operation if there is a change, removal, or new row. 1 = New row, 2 = Change 3 = Removal.
I do like this below now, it works if you just make one change. If you make two changes or more on the same row, for example, the number and price, it does not work. Even if there are no changes at all on these three fields it dont work. What I have done is wrong, so the question is how I will do it right?
asked 31 May '15, 05:14
I may not have understood your question fully, but would it not be simply like that (possibly rounded as required)?