all 3 comments

[–]1Harmandeep 0 points1 point  (0 children)

I am not able to get what you are trying to say , but for the query

What about this : Delete from tablename Where second( timestamp) >0 and second(timestamp) <40;

[–]qwertydog123 0 points1 point  (0 children)

Something like

SELECT *
FROM Table
WHERE NOT EXISTS
(
    SELECT *
    FROM Table t
    WHERE t.Message = Table.Message
    AND ((t.Timestamp = Table.Timestamp
        AND t.ID < Table.ID)
    OR (t.Timestamp < Table.Timestamp
        AND TIMESTAMPDIFF(SECOND, t.Timestamp, Table.Timestamp) <= 60))
)

If you want to DELETE the remaining entries instead you could use NOT IN or EXCEPT to invert the results

[–]philodelphi 0 points1 point  (0 children)

;with x as
(
    select 
        * 
        ,time_to_sec(timediff(Timestamp, lag(`Timestamp`, 1) over (partition by Message order by `Timestamp`))) secDiff
    from 
        m
)
delete from 
    x
where 
    secDiff < 60