So given a table like the one below, I would like to grab rows where id
has at least three consecutive years.
+---------+--------+
| id | year |
+------------------+
| 2 | 2003 |
| 2 | 2004 |
| 1 | 2005 |
| 2 | 2005 |
| 1 | 2007 |
| 1 | 2008 |
+---------+--------+
The result over here would be of course:
+---------+
| id |
+---------+
| 2 |
+---------+
Any input at all as to how I could go about structuring a query to do this would be great.