Take min() deviceName and location on index; big assumption here that user edits apply to all historical rows; closes #26.

This commit is contained in:
jkaplon 2015-07-23 21:09:50 -04:00
parent ba5b091c54
commit 8ae19ac07f

View File

@ -65,7 +65,7 @@ app.get('/', function(req, res){
var devIndexQry = var devIndexQry =
"select coreId, coreName, locationDesc, max(published_at) as MaxPub, max(status) as MaxStatus " + "select coreId, coreName, locationDesc, max(published_at) as MaxPub, max(status) as MaxStatus " +
"from Alerts otbl " + "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;"; "group by coreId, coreName, locationDesc;";
db.all(devIndexQry, function(err, rows){ db.all(devIndexQry, function(err, rows){
if(err !== null) { if(err !== null) {