#查询每秒钟活跃人数
(默认一个人不会同时往多个日志表写数据,也不会同时往一个表写入多条日志操作记录)
SELECT COUNT(operator_uid) AS activor, DATE_FORMAT(operator_time,’%Y-%m-%d-%h-%i-%s’)
FROM(
SELECT a.operation_uid AS operator_uid,a.operation_time AS operator_time
FROM collection_log a UNION
SELECT b.operator_uid,b.operator_time
FROM invoice_log b UNION
SELECT c.operator_uid,c.operator_time
FROM order_log c
)tmp
GROUP BY DATE_FORMAT(operator_time,’%Y-%m-%d-%h-%i-%s’)
ORDER BY activor DESC