2
date        |  name      | go to work 
------------+------------+---------
02/01/2012  | Mike       |  train
03/01/2012  | Mike       |  train
04/01/2012  | Mike       |  bus
07/01/2012  | Mike       |  bus
08/01/2012  | Mike       |  bus
09/01/2012  | Mike       |  train

有了这些记录,我想创建一个表:

name     from        to              go to work 
------------------------------------------------
Mike     02/01/2012  03/01/2012        train
Mike     04/01/2012  08/01/2012        bus
Mike     09/01/2012  09/01/2012        train

我不知道如何在 Access 中编写 SQL 代码。

有人可以帮助我吗?

4

1 回答 1

1
SELECT  name, MIN(`date`) AS from, MAX(`date`) AS to 
FROM your_table
GROUP BY name, go_to_work
于 2012-07-09T14:34:58.100 回答