我如何从表格中获取最新日期。如果我告诉你我的意思,也许会更好。
这是我当前的表格输出
TransactionID Title Date
23132 Locaton 2013-05-17 10:02:04
23131 Novuel 2013-05-16 16:26:45
23130 Novuel 2013-05-16 11:41:21
23129 Locaton 2013-05-15 15:02:47
23128 Mama Rosa 2013-05-15 14:42:44
23127 Locaton 2013-05-14 18:21:32
23126 Rohan 2013-05-14 12:46:56
这是所需的输出:
TransactionID Title Date
23132 Locaton 2013-05-17 10:02:04
23131 Novuel 2013-05-16 16:26:45
23128 Mama Rosa 2013-05-15 14:42:44
23126 Rohan 2013-05-14 12:46:56
如您所见,我只想要mysql中每个标题的最新日期。
这就是我迄今为止尝试获得所需输出的方式:
("SELECT t.transactionid,
ct.title,
max(t.transactiontime)
FROM exp_channel_titles AS ct
LEFT JOIN transactions AS t ON (ct.entry_id = t.restaurant_id)
WHERE t.transactiontime IN
(SELECT max(t.transactiontime)
FROM transactions AS t)
GROUP BY ct.entry_id
ORDER BY t.transactiontime DESC");