Это SQL-оператор:
SELECT
dbo.tblWorkflow.WorkflowName,
ISNULL((SELECT SUM(dbo.tblSchemaOperation_Execution.ExecutedQuantity * dbo.tblOperationItemPrice.UnitPrice) AS Amount
FROM dbo.tblSchemaOperation_Execution
INNER JOIN dbo.tblOperationItemPrice ON dbo.tblSchemaOperation_Execution.OperationID = dbo.tblOperationItemPrice.OperationID
GROUP BY dbo.tblSchemaOperation_Execution.SchemaYear,
dbo.tblSchemaOperation_Execution.SchemaNO
HAVING (dbo.tblSchemaOperation_Execution.SchemaNO = dbo.tblWorkflowActivtyInsatnce.SchemaNO) AND
(dbo.tblSchemaOperation_Execution.SchemaYear = dbo.tblWorkflowActivtyInsatnce.SchemaYear)), 0) AS ActualAmount
FROM dbo.tblWorkflowActivtyInsatnce
INNER JOIN dbo.tblWorkflow ON dbo.tblWorkflowActivtyInsatnce.WorkflowID = dbo.tblWorkflow.WorkflowID
INNER JOIN dbo.tblWorkflowActivity ON dbo.tblWorkflowActivtyInsatnce.WorkflowActivityID = dbo.tblWorkflowActivity.WorkflowActivityID
WHERE (dbo.tblWorkflowActivtyInsatnce.StartDate IS NOT NULL)
AND (dbo.tblWorkflowActivtyInsatnce.FinishDate IS NULL)
AND (dbo.tblWorkflowActivity.ActivityName <> 'Execution')
и вывод:
WorkFlowName : ActualAmount
------------ : ------------
Sceco : 28020.00
Sevareg : 5005.00
Sevareg : 1100.00
Как я могу использовать сумму, чтобы получить сумму Севарег? как это
WorkFlowName : ActualAmount
------------ : ------------
Sceco : 28020.00
Sevareg : 6105.00