-4

I have a table 'example' which looks like this

id index   date        number
============================
1   10   2016-01-01     26
2   10   2016-01-02     0
3   10   2016-01-03     26
4   11   2016-01-01     39

I wish to find the record which was updated wrongly. In this case it is the row with id 2(as you can see the next and previous date values for 'number' column are same for the query select * from example where index=10 order by date desc);

vCillusion
  • 1,749
  • 20
  • 33
Sahanaa01
  • 1
  • 3

1 Answers1

0

Your requirements are rather ambiguous so this is based on my assumptions of them.

SELECT id, index, MIN(date) AS date, number
FROM example
WHERE index = 10
GROUP BY id, index, number
Matt
  • 14,906
  • 27
  • 99
  • 149