1
我有這樣的表結構MySQL的記錄排序問題
leadid agentid datetime ip
1 6 2016-06-17 12:55:48 127.0.0.1
5 6 2016-06-17 12:56:26 127.0.0.1
9 6 2016-06-17 12:58:18 127.0.0.].
13 6 2016-06-17 12:58:19 127.0.0.1
17 6 2016-06-17 12:58:20 127.0.0.1
2 7 2016-06-17 12:55:54 127.0.0.1
6 7 2016-06-17 12:56:32 127.0.0.1
10 7 2016-06-17 12:58:18 127.0.0.1
14 7 2016-06-17 12:58:19 127.0.0.1
18 7 2016-06-17 12:58:20 127.0.0.1
3 8 2016-06-17 12:55:56 127.0.0.].
7 8 2016-06-17 12:58:18 127.0.0.1
11 8 2016-06-17 12:58:19 127.0.0.1
15 8 2016-06-17 12:58:20 127.0.0.1
19 8 2016-06-17 12:58:21 127.0.0.1
4 9 2016-06-17 12:56:22 127.0.0.1
8 9 2016-06-17 12:58:18 127.0.0.1
12 9 2016-06-17 12:58:19 127.0.0.1
16 9 2016-06-17 12:58:20 127.0.0.1
20 9 2016-06-17 12:58:21 127.0.0.1
我要選擇一個記錄,其中日期時間升序排序 例如6的agentId與日期時間2016年6月17日12:55各的agentId :48應選擇和agentid 7 datetime 2016-06-17 12:55:54應該選擇
是否有可能做到一個查詢?
我知道查詢沒有道理,但只是解釋什麼是我想要做的
SELECT COUNT(agentid)
, `agentid`
, `datetime`
FROM leadassignment
GROUP
BY agentid
ORDER
BY datetime ASC
Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'timeshareleads.leadassignment.datetime' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
@Strawberry,作爲您所做的編輯,您是如何將圖像轉換爲文本的? –
我使用了OneNote。 – Strawberry
@Strawberry,有趣,讓我檢查一下,謝謝! –