0

I'm trying to update with some condition:

UPDATE a
SET a.FLEX_ERROR =  CASE 
                        WHEN ((a.NUM = 1 OR A.CODE = 'D') AND SUM(a.POINT) <> b.TOTAL_VALUE)
                        THEN 1
                        ELSE 0
                    END       
FROM my_scheme.dbo.FIRST_TABLE a INNER JOIN
my_scheme.dbo.SECOND_TABLE b
ON a.ROLE = b.ROLE AND 
   a.YEAR = b.YEAR AND
   a.MONTH = b.MONTH AND
WHERE a.STATUS = 2
GROUP BY a.ROLE, a.YEAR, b.MONTH

With SUM condition get from groupped. How can i implement this query

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.