Mysql 根据时间戳按年月日分组统计create_time时间格式SELECT DATE_FORMAT(create_time,'%Y%u') weeks,COUNT(id) COUNT FROM role GROUP BY weeks;SELECT DATE_FORMAT(create_time,'%Y%m%d') days,COUNT(id) COUNT FROM role GROUP BY days;SELECT DATE_FORMAT(create_time,'%Y%m') month
mysql查询时间戳转换 SELECT FROM_UNIXTIME(create_time) FROM tablename; 更新时间为七天以后 UPDATE t_rebate_trade_item SET delivered_time=DATE_SUB(delivered_time,INTERVAL 7 DAY) WHERE order_id=xxx;
自己做的一个小项目里需要用mysql计算一些信息. mysql中的 表如下(注:表中数据都是测试数据,随机生成的) mysql> select * from shake_log; +-----+-------------+--------+---------------------+------+ | id | mobile | credit | time | type | +-----+-------------+--------+---------------------+------+ |