From 274baa1aeada096cf66cdd27d8daf7c33d47cec1 Mon Sep 17 00:00:00 2001 From: kennyboy55 Date: Tue, 11 Apr 2017 11:37:30 +0200 Subject: [PATCH] SQL syntax error --- mean-app/server/routes/webapi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mean-app/server/routes/webapi.js b/mean-app/server/routes/webapi.js index dbd2ff2..406a14b 100644 --- a/mean-app/server/routes/webapi.js +++ b/mean-app/server/routes/webapi.js @@ -160,7 +160,7 @@ router.get('/data/:device/group/:group', function(req, res) { console.log("Calculating group ", groupdiv); connection.query( - 'SET @i:=0; SELECT MIN(grp.`time`) as `time`, AVG(grp.`HOV`) as HOV, AVG(grp.`HTV`) as HTV FROM (SELECT @i:=@i+1 AS `rownum`, FLOOR(@i/?) AS `datagrp`, `time`, `HOV`, `HTV` FROM `measurement` WHERE `device` = ? ORDER BY `time` DESC ) grp GROUP BY `datagrp`', [groupdiv, devid], + 'SET @i:= 0; SELECT MIN(grp.`time`) AS time, AVG(grp.`HOV`) AS HOV, AVG(grp.`HTV`) AS HTV FROM (SELECT @i:=@i+1 AS `rownum`, FLOOR(@i/?) AS `datagrp`, `time`, `HOV`, `HTV` FROM `measurement` WHERE `device` = ? ORDER BY `time` DESC ) grp GROUP BY `datagrp`', [groupdiv, devid], function (error, results, fields) { if (error) throw error;