I have a mysql table, a simplified version below:
ID Col1 Col2 CreatedDate
232 my data some data 2017-10-15 8:50:20
232 my data some data 2017-10-14 8:52:20
232 my data some data 2017-10-13 8:53:20
232 my data some data 2017-10-12 8:55:20
232 my data some data 2017-10-11 8:54:20
ID
is int
and CreatedDate
isdatetime
I want to save the last two lines and delete all the rest with the same identifier. I will get ID
from old.ID in the trigger (e.g. where ID=old.ID
).
Any help?
source
share