例如我有下表:
items
-----
item_id (usigned-int, not-null, auto-increment, primary)
created_at (datetime, not-null)
...
我有以下数据集:
(1, 01/01/2012)
(2, 03/01/2012)
(3, 07/01/2012)
(4, 12/01/2012)
(5, 28/01/2012)
(6, 02/02/2012)
(7, 06/02/2012)
(8, 13/02/2012)
(9, 27/02/2012)
我想得到以下结果:
(3, 07/01/2012)
(4, 12/01/2012)
(5, 28/01/2012)
(8, 13/02/2012)
(9, 27/02/2012)
即跳过每个月的前(n = 两个)记录。
我怎样才能用 MySQL 实现这一点?