Ramco Ramco

Ramco Ramco

  • 440
  • 3.4k
  • 527.6k

Error - An aggregate may not appear in the set list of an UPDATE state

Jun 23 2023 3:25 PM

Hi

  In below code i am getting error

UPDATE [SessionDeliveryParticipant]
SET Attendance = CASE
    WHEN (
        SELECT COUNT(*) 
        FROM [SessionDeliveryParticipant] AS sub 
        WHERE sub.SessionDeliveryCalendarID = SessionDeliveryCalendarID
        AND sub.PresentInSession = 0
    ) = COUNT(*) THEN 1
    ELSE 0
END;

Thanks


Answers (2)