The timestamp field is a DATETIME
column in a format like 2012-03-19 00:23:14
. How can I compare two rows of timestamps and find the larger one? The query below that I am using isn t working.
UPDATE report 1 status = time is larger WHERE EXISTS
(SELECT ip_src, layer4_sport, timestamp FROM
(SELECT ip_src, layer4_sport, timestamp from report 1) AS tmpb
WHERE report 1.layer4_sport = tmpb.layer4_sport
AND report 1.ip_src = tmpb.ip_src
AND report 1.timestamp > tmpb.timestamp
GROUP BY ip_src, layer4_sport, timestamp HAVING COUNT(*) = 2)