Subject simulation of REPLACE by pseudounique key in trigger
Author Michal Žeravík

I have small problem. Doing stats for the site have a table stat:
id int,
entity varchar(10),
parentid int,
action varchar(10),
uniqueid char(32),
unixtime int

Well, I'm inserting a row with values from actual request.
So I have rows:
'article', 30, 'ret3453..', 'open', 1105998410
'article', 30, 'ret3453..', 'open', 1105998434
'article', 30, 'ret3453..', 'increment', 1105998470

Problem: I need to select all only greatest (unique) unixtimes and its
for actual entity, its parentid and uniqueid.
These values gives an composite unique key.

I've got idea I could run a trigger before every insert,
which would delete actual record with this key values
and then command would insert new record with actual unixtime.

Can I ask someone to help me?
I'm a firetrigger greenhorn.