Pregunta

Below is my code:

SELECT HOUR(asl.Start_Time) AS [Hour],
       t.team_name,
       SUM( CASE WHEN asl.Working = 1 
                 THEN asl.Duration_Seconds 
                 ELSE 0 END) 
           AS TotalSeconds
FROM (Agents 
         INNER JOIN Teams AS t 
         ON Agents.team_no = Teams.team_no)
      INNER JOIN AgentStateLogs AS asl 
      ON Agents.agent_no = asl.Agent_No
GROUP BY t.team_name, HOUR(asl.Start_Time);

The problem is that it is saying there is a missing operator in the statement:

SUM( CASE WHEN asl.Working = 1 
          THEN asl.Duration_Seconds 
          ELSE 0 END) 
    AS TotalSeconds

Ive been trying to find it and I just cant see where the error lies. Can anyone shed some light on this for me? This code is being done in MS Access 2013.

Thank you in advance.

¿Fue útil?

Solución

CASE WHEN asl.Working = 1 
THEN asl.Duration_Seconds 
ELSE 0 END

Translated to JET, this becomes

IIf(asl.Working = 1, asl.Duration_Seconds, 0)

Search for immediate if in the manual for more information.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top