我有我的桌子transfer
| id | fix | part | created |
| + | + | + | + |
| + | + | + | + |
| 238 | 1 | 1 | 2012-02-10 21:15:48 |
| 239 | 9 | 1 | 2012-02-11 12:36:17 |
| 240 | 1 | 2 | 2012-02-12 23:35:28 |
| 241 | 2 | 1 | 2012-02-13 06:17:35 |
| 242 | 4 | 2 | 2012-02-14 17:45:42 |
| 243 | 1 | 1 | 2012-02-15 20:32:58 |
| 244 | 2 | 2 | 2012-02-16 12:52:19 |
| 245 | 3 | 1 | 2012-02-17 22:35:56 |
| 246 | 1 | 2 | 2012-02-18 09:11:23 |
| 247 | 3 | 1 | 2012-02-19 19:46:44 |
| 248 | 1 | 1 | 2012-02-20 02:30:14 |
| 249 | 2 | 1 | 2012-02-21 13:36:49 |
| 250 | 1 | 3 | 2012-02-22 21:35:34 |
| 251 | 1 | 1 | 2012-02-23 19:25:12 |
| 252 | 1 | 2 | 2012-02-24 18:53:43 |
| 253 | 1 | 3 | 2012-02-25 21:05:28 |
| 254 | 3 | 1 | 2012-02-26 12:33:35 |
| 255 | 1 | 1 | 2012-02-27 18:35:18 |
| 256 | 4 | 1 | 2012-02-28 22:15:27 |
| 257 | 4 | 1 | 2012-03-01 12:22:17 |
| 258 | 2 | 2 | 2012-03-02 10:19:24 |
| 259 | 9 | 1 | 2012-03-03 18:45:46 |
| 260 | 1 | 2 | 2012-03-04 23:19:07 |
| 261 | 2 | 1 | 2012-03-05 09:11:11 |
| 262 | 1 | 1 | 2012-03-06 21:25:29 |
| + | + | + | + |
| + | + | + | + |
| 901 | 1 | 3 | 2012-04-30 22:15:27 |
| 902 | 3 | 1 | 2012-05-01 12:22:17 |
| 903 | 2 | 1 | 2012-05-02 10:19:24 |
| 904 | 1 | 1 | 2012-05-03 18:45:46 |
| + | + | + | + |
| + | + | + | + |
并希望保持最新的 ( created
) 3 行的每一个相同的fix
列part
,间隔为.. 例如 3 个月。如果只有 1 或 2 行,则显示它们!id
(例如见242)
我尝试了几件事并在 stackoverflow 上进行了搜索,但没有找到带有额外列 ( part
) 的解决方案。
处理后表格transfer
应如下所示:
| id | fix | part | created |
| 904 | 1 | 1 | 2012-05-03 18:45:46 |
| 262 | 1 | 1 | 2012-03-06 21:25:29 |
| 255 | 1 | 1 | 2012-02-27 18:35:18 |
| 260 | 1 | 2 | 2012-03-04 23:19:07 |
| 252 | 1 | 2 | 2012-02-24 18:53:43 |
| 246 | 1 | 2 | 2012-02-18 09:11:23 |
| 901 | 1 | 3 | 2012-04-30 22:15:27 |
| 253 | 1 | 3 | 2012-02-25 21:05:28 |
| 250 | 1 | 3 | 2012-02-22 21:35:34 |
| 903 | 2 | 1 | 2012-05-02 10:19:24 |
| 261 | 2 | 1 | 2012-03-05 09:11:11 |
| 249 | 2 | 1 | 2012-02-21 13:36:49 |
| 258 | 2 | 2 | 2012-03-02 10:19:24 |
| 244 | 2 | 2 | 2012-02-16 12:52:19 |
| 902 | 3 | 1 | 2012-05-01 12:22:17 |
| 254 | 3 | 1 | 2012-02-26 12:33:35 |
| 247 | 3 | 1 | 2012-02-19 19:46:44 |
| 257 | 4 | 1 | 2012-03-01 12:22:17 |
| 256 | 4 | 1 | 2012-02-28 22:15:27 |
| 242 | 4 | 2 | 2012-02-14 17:45:42 |
| 259 | 9 | 1 | 2012-03-03 18:45:46 |
| 239 | 9 | 1 | 2012-02-11 12:36:17 |
为了更好地理解fix
,我订购了这个例子。part
也许有人可以给我一个提示?