Praveen Jagadeesan
Praveen Jagadeesan

Reputation: 13

Error: Cannot perform an aggregate function SQL

1.) I am getting an error for using SUM function in SQL is there a possible way to fix this, I tried searching the internet, but most of the examples are for single column.

SELECT    
    r.WorkOrderBatch,
    wo.ProductCode,
    wo.WorkOrderQty,
    Convert(DATE,wo.StartDate),
    wo.CurrentStatus,

Upvotes: 0

Views: 47

Answers (1)

Rahul Jain
Rahul Jain

Reputation: 1399

replace this line:

SUM(COUNT(CASE r.IsTestPass WHEN 1 THEN NULL ELSE 1 END)) AS FailedQty

With

SUM(CASE r.IsTestPass WHEN 1 THEN 0 ELSE 1 END) AS FailedQty

rest everything looks good

Upvotes: 1

Related Questions