#年、月、天、时、分、秒
datediff(yy,date1,date2)
datediff(m,date1,date2)
datediff(d,date1,date2)
datediff(hh,date1,date2)
datediff(n,date1,date2)
datediff(s,date1,date2)
datediff(ms,date1,date2)
例子:
select product_id,DATEDIFF(MINUTE,min(client_time),max(client_time)) as time
from game_publish
where product_id = 1000272
and client_time>='2018-10-19 00:00:00'
and client_time<'2018-10-20 00:00:00'
group by product_id,token
order by product_id;
product_id | time |
---|---|
1000272 | 54 |
1000272 | 61 |
网友评论