SQL 语句

一、统计今天(时间戳)

SELECT
	COUNT( mob_id ) AS count 
FROM
	shipping_mob 
WHERE
	del_flag = 0 
	AND FROM_UNIXTIME( mob_time / 1000, '%Y-%m-%d' ) = DATE_FORMAT(
	NOW(),
	'%Y-%m-%d')

二、统计3天内(时间戳)

SELECT
	COUNT( mob_id ) 
FROM
	shipping_mob 
WHERE
	STATUS = 0 
	AND del_flag = 0 
	AND FROM_UNIXTIME( mob_time / 1000, '%Y-%m-%d %H:%i:%s' ) >= now() - INTERVAL 3 DAY;
posted @ 2021-09-01 09:11  方大帝的博客  阅读(16)  评论(0编辑  收藏  举报