How to determine the difference among dates in the same column?
- by Vera
How to determine the difference among dates of birth?
+----------+----------+------------+
| id | name | birth |
+----------+----------+------------+
| 00001 | Claws | 2010-04-17 |
| 00002 | Claws | 2010-01-31 |
| 00003 | Claws | 2009-11-31 |
| 00004 | Claws | 2009-09-31 |
| 00005 | Claws | 2009-07-31 |
| 00006 | Claws | 2008-10-31 |
+----------+----------+------------+
I would like to obtain this:
+----------+----------+------------+------------------------------------------+
| id | name | birth |
diff |
+----------+----------+------------+------------------------------------------+
| 00001 | Claws | 2010-04-17 |
diff (id1-id2) = 2010-01-31 -
2010-04-17 |
| 00002 | Claws | 2010-01-31 |
diff (id2-id3) = 2010-01-31 -
2009-11-31 |
| 00003 | Claws | 2009-11-31 |
diff (id3-id4) = 2010-01-31 -
2009-09-31 |
If possible, ORDER BY diff DESC
Thank you for helping
Vera