discuz论坛业务量统计

discuz论坛业务量统计语句mysql

查看2018-7-1到2019-6-30年度内
一、数据维护类
select count(distinct(tid)) from cdb_posts where 
 dateline between unix_timestamp('2018-7-1 0:0:1') and unix_timestamp('2019-6-30 23:59:59') 
 and fid in (84, 83, 82, 81, 80, 91, 90, 89, 704, 88, 87, 84, 610, 611, 92, 353, 93, 697, 94, 278, 279, 462, 291, 97, 99, 103); --属于这类的所有版块编号
二、功能需求类
select count(distinct(tid)) from cdb_posts where 
 dateline between unix_timestamp('2018-7-1 0:0:1') and unix_timestamp('2019-6-30 23:59:59') 
 and fid in (705, 296, 297, 298, 299, 300, 301, 567, 606, 706, 3, 348 ,5, 280, 11, 14, 43);  --136
三、问题分析类 
select count(distinct(tid)) from cdb_posts where 
 dateline between unix_timestamp('2018-7-1 0:0:1') and unix_timestamp('2019-6-30 23:59:59')
 and fid in (537, 554, 555, 544, 545, 561, 556, 557, 558, 559, 560);  --2426
四、数据提取类(市局用)
 select count(distinct(tid)) from cdb_posts where 
 dateline between unix_timestamp('2018-7-1 0:0:1') and unix_timestamp('2019-6-30 23:59:59') 
 and fid in (148, 345, 150, 274, 153, 155, 163);   --78

五区医疗科和市直医疗科发帖和跟帖数
select count(*) from cdb_posts where 
dateline between unix_timestamp('2019-1-1 0:0:0') and unix_timestamp('2020-1-1 0:0:0') and
authorid in (16,21,40,34,46,52);  --五区医疗科和市直医疗科账号id


字段说明:
fid 板块id
tid 主题id  =  subject id , 对应表cdb_threads
pid 同一主题下的帖子回复id,对应表cdb_posts
 
主题tid=6455下的所有回复,
select * from cdb_posts where tid=6455;
 
 select * from cdb_moderators;

时间字符串与时间戳互换
select from_unixtime(1530374401)
select unix_timestamp('2018-7-1 0:0:1')
 

你可能感兴趣的:(mysql)