mysql 时间转换成日期

很多时候都存了当前时间,没有单独存日期这个函数。查询按天查询的时候,需要转换成日期。

select DATE_FORMAT(create_time, "%Y-%m-%d") as day, count(DISTINCT(product_user_id)) as uv, count(product_user_id)  as pv  from dts_pay_order where client_id = 32  and create_time > '2023-03-01' and create_time < '2023-04-01'

GROUP BY DATE_FORMAT(create_time, "%Y-%m-%d") ORDER BY create_time;

 

posted @ 2023-04-04 11:55  变换  阅读(120)  评论(0编辑  收藏  举报