这是我的表结构:
+------------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------+------+-----+---------+-------+
| uid | char(255) | NO | MUL | NULL | |
| cid | char(255) | NO | MUL | NULL | |
| ip_address | char(15) | NO | | NULL | |
| user_agent | char(255) | YES | | NULL | |
| open_date | datetime | NO | MUL | NULL | |
| referrer | char(255) | YES | | NULL | |
| environ | text | YES | | NULL | |
| country | char(255) | NO | MUL | NULL | |
+------------+-----------+------+-----+---------+-------+
我希望在一定范围内每分钟获得一个时间戳。
select DATE_ADD(open_date,interval 1 minute)
as m from open_track.camp_open where open_date between
"2009-05-13 00:00:00" and "2009-05-13 23:59:59" limit 10;
输出
+---------------------+
| m |
+---------------------+
| 2009-05-13 00:01:01 |
| 2009-05-13 00:01:02 |
| 2009-05-13 00:01:03 |
| 2009-05-13 00:01:03 |
| 2009-05-13 00:01:04 |
| 2009-05-13 00:01:05 |
| 2009-05-13 00:01:06 |
| 2009-05-13 00:01:08 |
| 2009-05-13 00:01:08 |
| 2009-05-13 00:01:09 |
+---------------------+
请告诉我。
答案 0 :(得分:1)
我想要每分钟打开次数
SELECT COUNT(*),
DATE_FORMAT(open_date, '%Y-%m-%d %H:%i')
FROM camp_open
GROUP BY DATE_FORMAT(open_date, '%Y-%m-%d %H:%i')
答案 1 :(得分:0)
@zerkms
非常感谢!!!!
查询以查找特定日期内一分钟内的最高点数
选择COUNT(*)为c,DATE_FORMAT(open_date,'%Y-%m-%d%H:%i')为m 来自camp_open “2009-05-13 00:00:00”和“2009-05-13 23:59:59”之间open_date的位置 GROUP BY m order by c desc limit 1;