我正在制作水晶报告,我正在制作基于效果的报告。这是我的查询
select mguser.userID, mguser.userName as Loger,date_format(trschedule.insDate,'%Y-%m-%d') as _Date,
count(distinct trschedule.scheduleID) as Schedule_Count, count(*) segment_count
FROM
mguser
我希望将这两列的总和--- count(distinct trschedule.scheduleID)作为Schedule_Count,count(*)segment_count
我怎样才能在mysql ???
中执行此操作答案 0 :(得分:2)
select Loger,_Date, (Schedule_Count + segment_count) sum from
(
select mguser.userID, mguser.userName as Loger,
date_format(trschedule.insDate,'%Y-%m-%d') as _Date,
count(distinct trschedule.scheduleID) as Schedule_Count,
count(*) segment_count
FROM
mguser
)d