Enable multiple statements
This commit is contained in:
@@ -4,7 +4,8 @@ var connection = mysql.createConnection({
|
||||
user : 'root',
|
||||
password : 'asdf1239',
|
||||
database : 'smarthome',
|
||||
timezone : 'utc'
|
||||
timezone : 'utc',
|
||||
multipleStatements: true
|
||||
});
|
||||
|
||||
connection.connect(function(err) {
|
||||
|
||||
@@ -158,7 +158,7 @@ router.get('/data/:device/group/:group', function(req, res) {
|
||||
}
|
||||
|
||||
connection.query(
|
||||
'SET @i:= 0; SELECT MIN(grp.`time`) AS t, 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user