-1

I am trying to run this query in ms access but ms access keeps telling me there is a syntax error in the case statement. May you assist me in fixing my CASE statement please

SELECT COUNT(*) AS total_number_of_followups_scheduled,
       COUNT(CASE  WHEN status = 'Completed' THEN 1 END) AS number_followups_completed
FROM   promis_lt
sticky bit
  • 36,626
  • 12
  • 31
  • 42
Ruva
  • 47
  • 5

1 Answers1

2

MS Access doesn't support CASE expressions. You need to use IIF() or SWITCH():

SELECT COUNT(*) AS total_number_of_followups_scheduled, 
       SUM(IIF(status = 'Completed', 1, 0 END)) AS number_followups_completed
FROM promis_lt
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786