Lets say I have a table mags
with fields - REVDate, name, and Printorder
On an insert containing REVDate and name
I want to use a trigger (with or without a procedure/function) to do the following:
Select then max(printorder) from mags where REVDate = New.REVDate;
Add 1 to the max(printorder) selected
and then set Printorder for this insert to this new value.
so if the max(printorder) in the database is 5 on a new insert :
REVDate = June and name = John...the printorder would end up being 6
Can anyone help me with how to do this?