SELECT
date_add(DATE_ADD(curdate(), INTERVAL - DAY(curdate()) + 2 DAY), INTERVAL (cast( help_topic_id AS signed INTEGER ) - 1 ) DAY ) date ,
(SELECT count(temp_id) from ows_order oo where left(oo.create_time, 10) = date) total_count
from mysql.help_topic
where help_topic_id < day(curdate())
order by total_count desc;
SELECT
date_add(DATE_ADD(curdate(), INTERVAL - DAY(curdate()) + 2 DAY), INTERVAL (cast( help_topic_id AS signed INTEGER ) - 1 ) DAY ) date ,
(SELECT count(temp_id) from ows_order oo where left(oo.create_time, 10) = date and oo.completed_type in (1,2)) total_count
from mysql.help_topic
where help_topic_id < day(curdate())
order by total_count desc;
SELECT
date_add(DATE_ADD(curdate(), INTERVAL - DAY(curdate()) + 2 DAY), INTERVAL (cast( help_topic_id AS signed INTEGER ) - 1 ) DAY ) date ,
(SELECT count(temp_id) from ows_order oo where left(oo.create_time, 10) = date and oo.closed_time is not null) total_count
from mysql.help_topic
where help_topic_id < day(curdate())
order by total_count desc
;
(select count(temp_id) q from ows_order where left(create_time, 7) = DATE_FORMAT(NOW(),'%Y-%m') )
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 7) = DATE_FORMAT(NOW(),'%Y-%m') and completed_type in (1,2)
)
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 7) = DATE_FORMAT(NOW(),'%Y-%m') and closed_time is not null
)
(select count(temp_id) q from ows_order where left(create_time, 7) = '2022-03' )
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 7) = '2022-03' and completed_type in (1,2)
)
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 7) = '2022-03' and closed_time is not null
)
(select count(temp_id) q from ows_order where left(create_time, 10) >= '2022-04-01' and left(create_time, 10) <= '2022-04-07' )
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 10) >= '2022-04-01' and left(create_time, 10) <= '2022-04-07' and completed_type in (1,2)
)
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 10) >= '2022-04-01' and left(create_time, 10) <= '2022-04-07' and closed_time is not null
);
(select count(temp_id) q from ows_order where left(create_time, 10) >= '2022-04-07' and left(create_time, 10) <= '2022-04-14' )
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 10) >= '2022-04-07' and left(create_time, 10) <= '2022-04-14' and completed_type in (1,2)
)
UNION all
(
select count(temp_id) q from ows_order where left(create_time, 10) >= '2022-04-07' and left(create_time, 10) <= '2022-04-14' and closed_time is not null
)
SELECT user_id, count(temp_id) q from ows_order where left(create_time, 7) = DATE_FORMAT(NOW(),'%Y-%m') and completed_type in (1,2) GROUP BY user_id ORDER BY q desc limit 15