寻找一个查询来为进入网站的人提取第一个和最后一个条目

Looking for a query to pull a first and last entry for a people entering site

我希望根据以下 table:

跟踪每天登录的人
TimeStamp           |   PersonName  |  Location | ID
------------------- | --------------| ----------| ----
19/11/2016 07:51:06 | John Brady    | Admin     | 1234
19/11/2016 07:51:10 | Alan Hartigan | Admin     | 1233
19/11/2016 07:51:10 | Kris King     | Store     | 1232
19/11/2016 07:51:14 | John Brady    | Store     | 1234
19/11/2016 07:55:12 | John Forest   | Store     | 1231
19/11/2016 10:15:03 | John Brady    | Admin     | 1234
19/11/2016 10:30:23 | Alan Hartigan | Admin     | 1233
19/11/2016 13:32:51 | Kris King     | Store     | 1232
19/11/2016 13:39:51 | John Brady    | Store     | 1234
19/11/2016 13:59:51 | John Forest   | Store     | 1231
19/11/2016 14:32:51 | John Brady    | Admin     | 1234
19/11/2016 15:32:51 | Alan Hartigan | Admin     | 1233
19/11/2016 15:52:51 | Kris King     | Store     | 1232
19/11/2016 16:12:51 | John Brady    | Store     | 1234
19/11/2016 16:32:51 | John Forest   | Store     | 1231
20/11/2016 07:51:06 | John Brady    | Admin     | 1234
20/11/2016 07:51:10 | Alan Hartigan | Admin     | 1233
20/11/2016 07:51:10 | Kris King     | Store     | 1232
20/11/2016 07:51:14 | John Brady    | Store     | 1234
20/11/2016 07:55:12 | John Forest   | Store     | 1231
20/11/2016 10:15:03 | John Brady    | Admin     | 1234
20/11/2016 10:30:23 | Alan Hartigan | Admin     | 1233
20/11/2016 13:32:51 | Kris King     | Store     | 1232
20/11/2016 13:39:51 | John Brady    | Store     | 1234
20/11/2016 13:59:51 | John Forest   | Store     | 1231
20/11/2016 14:32:51 | John Brady    | Admin     | 1234
20/11/2016 15:32:51 | Alan Hartigan | Admin     | 1233
20/11/2016 15:52:51 | Kris King     | Store     | 1232
20/11/2016 16:12:51 | John Brady    | Store     | 1234
20/11/2016 16:32:51 | John Forest   | Store     | 1231

根据时间戳,我希望获得所有在 19/11/2016 上登录和注销的人。

First Logging       |   Last Logging      | Person Name     |  ID 
------------------- | ------------------- | ----------------|------
19/11/2016 07:51:06 | 19/11/2016 16:12:51 | John Brady      | 1234  
19/11/2016 07:51:10 | 19/11/2016 15:32:51 | Alan Hartigan   | 1233  
19/11/2016 07:51:10 | 19/11/2016 15:52:51 | Kris King       | 1232  
19/11/2016 07:51:14 | 19/11/2016 16:12:51 | John Brady      | 1234  
19/11/2016 07:55:12 | 19/11/2016 16:32:51 | John Forest     | 1231

如有任何建议,我将不胜感激。

应该这样做

SELECT MIN(TimeStamp) as "First Logging", MAX(TimeStamp) as "Last Logging", PersonName, ID
FROM table
WHERE DATE(TimeStamp) = "2016-11-19"
GROUP BY PersonName, ID