各位大侠:
我通过下面语句:select c.workflow,count(c.BatchName) BatchNum,sum(c.ImageCount) ImageNum
from (select a.LogId,a.BatchId,a.BatchName,a.JobId,a.ServerId,a.Status,
a.Workflow,a.ImageCount,b.LoadDateTime,a.LastDateTime,a.Comments
from dbo.tbl_BatchesLog a inner join (select LogId,min(LastDateTime)
LoadDateTime, max(LastDateTime) lastDatetime from tbl_BatchesLog group by LogId) b
on a.LogId=b.LogId and a.LastDateTime=b.lastDatetime inner join tb1_statusinfo f
on a.status=f.status) c Inner join tbl_Jobs d On c.JobId=d.JobId Inner join
tbl_ServersInfo e On c.ServerId=e.ServerId and convert(nvarchar(10),c.LastDateTime,120) ='2010-09-16' group by workflow 查询得到workflow batchnum imagenum
Audit 2 4
Check 75 483
现在我想得到:
workflow batchnum imagenum
Audit 2 4
Check 75 483
Total 77 487
请问各位,应该如何改这个SQL语句呢?
我通过下面语句:select c.workflow,count(c.BatchName) BatchNum,sum(c.ImageCount) ImageNum
from (select a.LogId,a.BatchId,a.BatchName,a.JobId,a.ServerId,a.Status,
a.Workflow,a.ImageCount,b.LoadDateTime,a.LastDateTime,a.Comments
from dbo.tbl_BatchesLog a inner join (select LogId,min(LastDateTime)
LoadDateTime, max(LastDateTime) lastDatetime from tbl_BatchesLog group by LogId) b
on a.LogId=b.LogId and a.LastDateTime=b.lastDatetime inner join tb1_statusinfo f
on a.status=f.status) c Inner join tbl_Jobs d On c.JobId=d.JobId Inner join
tbl_ServersInfo e On c.ServerId=e.ServerId and convert(nvarchar(10),c.LastDateTime,120) ='2010-09-16' group by workflow 查询得到workflow batchnum imagenum
Audit 2 4
Check 75 483
现在我想得到:
workflow batchnum imagenum
Audit 2 4
Check 75 483
Total 77 487
请问各位,应该如何改这个SQL语句呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货