price create date
========== ===================
1201.39978 2014-12-16 06:58:38
1201.39978 2014-12-16 07:00:14
1201.39978 2014-12-16 07:00:38
1266.99982 2015-01-29 07:45:13
1265.9 2015-01-29 07:47:13
1264.99986 2015-02-29 07:49:13
1264.19988 2015-02-29 07:51:13
1262.69976 2015-03-29 07:53:13
1263.99989 2015-04-29 07:55:13
1263.69974 2015-04-29 07:57:13
如何根据时间戳获取日期的最后定价..? 请帮帮我
答案 0 :(得分:1)
http://sqlfiddle.com/#!9/44b64/1
SELECT p.*
FROM prices p
LEFT JOIN prices p1
ON p.create_date < p1.create_date
AND DATE(p.create_date) = DATE(p1.create_date)
WHERE p1.create_date IS NULL
答案 1 :(得分:0)
SELECT price,
created
FROM (SELECT Max(created) AS maxts
FROM table_name
GROUP BY Date(created)) AS m
INNER JOIN table_name t
ON m.maxts = t.created;
答案 2 :(得分:0)
select price from yourtablename orderby create_at asc limit 1;