I have this query in express js:
connection.connect();
var queryString = 'xxxxxxxxxxxxxxx';
connection.query(queryString, function(err, rows, fields) {
if (err) throw err;
for(var i in rows){
rows[i].bestPrice = rows[i].MIN(inventory.price);
delete rows[i].MIN(inventory.price);
}
res.writeHead(200, { 'Content-Type': 'application/json'});
res.end(JSON.stringify(rows););
});
connection.end();
It is querying some details about a laptop. The response JSON part looked like this before I added the for loop:
displayType: "LED"
vga: "Intel Graphics Media Accelerat"
partNumber: "A0100001"
MIN(inventory.price): "40000"
I want to change "MIN(inventory.price)" to "bestPrice", but it's not working. Any suggestion?