Monday, April 10, 2017

Captiva SQL to get the all Tasks

Number of tasks for all Batches
SELECT a.[STStepName], b.[PFProcessFlowName], SUM([STReady])
  FROM [IADB].[dbo].[uv_ProcessFlowStepsComputed]  a ,
       [IADB].[dbo].[uv_ProcessFlowsServer] b 
  WHERE a.STProcessFlowGuid = b.PFGuid
  AND STStepName IN ('ABCD','CEFG','KLMN')
  Group by a.[STStepName], b.[PFProcessFlowName]
   Order by a.[STStepName], b.[PFProcessFlowName]

Number of tasks for a Batch
SELECT a.[STStepName], b.[PFProcessFlowName], SUM([STReady])
  FROM [IADB].[dbo].[uv_ProcessFlowStepsComputed]  a , 
   [IADB].[dbo].[uv_ProcessFlowsServer] b
  WHERE a.STProcessFlowGuid = b.PFGuid
  AND a.STProcessFlowGuid IN ( select c.BTProcessFlowGuid FROM [IADB].[dbo].[Tbl_Batches] c 
   WHERE  c.BTBatchName = 'Batch_Name')
  AND STStepName IN ('ABCD','CEFG','KLMN')  
  Group by a.[STStepName], b.[PFProcessFlowName]
   Order by a.[STStepName], b.[PFProcessFlowName]

No comments:

Post a Comment

Total Pageviews