Example,
SELECT * FROM stats_table
order by accuracy desc, totals desc;
This is ordered by accuracy desc, totals desc
and it returns the following
id col_a amount col_b accuracy totals
881 stat_a 38.0 stat_b 71.60 162
884 stat_a 39.0 stat_b 70.52 173
109 stat_a 38.0 stat_b 69.91 105
880 stat_a 38.0 stat_b 69.88 249
883 stat_a 39.0 stat_b 69.47 262
I want the row removed if the accuracy AND totals is both lower than the row above, so from the example, id 109 should be removed as accuracy and totals are both lower than the row above, id 884
So it should end up like this
id col_a amount col_b accuracy totals
881 stat_a 38.0 stat_b 71.60 162
884 stat_a 39.0 stat_b 70.52 173
880 stat_a 38.0 stat_b 69.88 249
883 stat_a 39.0 stat_b 69.47 262
Ideally, as there are 1000s of rows, it should loop through the whole table.
please help