尝试创建事件时出现问题

时间:2016-10-19 19:07:33

标签: mysql

我正在尝试创建一个事件,但我收到以下错误:

enter image description here

我的疑问:

CREATE EVENT insert_count
ON SCHEDULE
EVERY 50 SECOND
COMMENT 'bla bla bla bla bla bla.'
DO BEGIN
INSERT INTO teste (nome, conectado, desconectado)
SELECT parceiro.nomeP AS 'Parceiro', 
SUM(di.connectedOr = 'true') AS 'ClientesConectados', 
SUM(di.connectedOr = 'false') AS 'ClientesDesconectados'
FROM vpn AS di
JOIN parceiro
ON parceiro.codParceiro = di.idpartner
WHERE di.comName REGEXP 'skytef-'
GROUP BY di.idpartner
END

1 个答案:

答案 0 :(得分:0)

问题可能是您的SUM。我认为他们应该是这样的:SUM(IF(di.connectedOr = 'true', 1, 0))