IF (( SELECT param FROM changes WHERE type = 'uptime' AND website_id = 1 ORDER BY timestamp DESC LIMIT 1 ) != 'up' )
INSERT INTO changes ( website_id, timestamp, type, param ) VALUES ( 1, NOW(), 'uptime', 'up' )
END IF;
这似乎是不正确的语法。我还能如何在单个查询中完成这项工作?