I am new to this node.js and postgres database. I have done everything perfect querying and getting result. My problem is that when I am running select query in pgAdmin I am getting some 100 rows as output..
My code:
app.get('/reconcile', function(req, res){
var villagename = req.query.query;
var village=name.substring(0,4);
console.log("sub="+village);
console.log("select * from xxxxxxxxx where level4 ILIKE '%"+village+"%'")
var query = client.query("select * from tn_village where level4 ILIKE '%"+village+"%'");
query.on('row', function(rows) {
res.send(rows);
});
});
What i want to achieve is .Suppose consider i am searching for "Apple" i am getting words matching "APP" form database by using above(Like) command..Now its showing json as alphabetical order..I want to display json as highest to lowest matching data in Json..
Help me to achieve this..Thanks in advance..