sql脚本如下
select m.muser as '用户',
min(n.ncn) as '提交次数',
count(m.mfilename) as '涉及文件数',
sum(m.addf) as '新增文件数',
sum(m.delf) as '删除文件数',
sum(m.modf) as '修改文件次数',
sum(m.mnins) as '插入行数',
sum(m.mndel) as '删除行数'
from
(
select a.user as muser,
b.filename as mfilename,
sum(b.nins) as mnins,
sum(b.ndel) as mndel,
sum(case chngtype when 1 then 1 else 0 end) as addf,
sum(case chngtype when 2 then 1 else 0 end) as delf,
sum(case chngtype when 0 then 1 else 0 end) as modf
from chng a,filechng b
where a.cn= b.cn
and a.date >=julianday(aux('DateStart',date('now')))*86400 -julianday('1970-01-01')*86400
and a.date <=julianday(aux('DateEnd' ,date('now')))*86400 -julianday('1970-01-01')*86400 +86400
group by a.user,b.filename
) as m,
(
select user as nuser,
count(cn) as ncn
from chng c
where date >=julianday(aux('DateStart',date('now')))*86400-julianday('1970-01-01')*86400
and date <=julianday(aux('DateEnd' ,date('now')))*86400-julianday('1970-01-01')*86400 +86400
group by c.user
) as n
where m.muser =n.nuser
group by m.muser
order by m.muser