From 8ae19ac07f2f6ff01ac4647d0ed78ae4975e3fd7 Mon Sep 17 00:00:00 2001 From: jkaplon Date: Thu, 23 Jul 2015 21:09:50 -0400 Subject: [PATCH] Take min() deviceName and location on index; big assumption here that user edits apply to all historical rows; closes #26. --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 6533548..46cdad4 100644 --- a/server.js +++ b/server.js @@ -65,7 +65,7 @@ app.get('/', function(req, res){ var devIndexQry = "select coreId, coreName, locationDesc, max(published_at) as MaxPub, max(status) as MaxStatus " + "from Alerts otbl " + - "where published_at = (select max(published_at) from Alerts where coreId = otbl.coreId) " + + "where published_at = (select min(published_at) from Alerts where coreId = otbl.coreId) " + "group by coreId, coreName, locationDesc;"; db.all(devIndexQry, function(err, rows){ if(err !== null) {