Make MySQL's ORDER BY dynamic in node.js
问题 I want to make the ORDER BY dynamic in mysql query in node.js. But it's not working. I console.log the multiQuery variable and everything looks perfect but when ran it simply doesn't work. This is what I have: var order, multiQuery; if(req.query.o){ order = req.query.o; }else{ order = "views"; } multiQuery = 'SELECT COUNT(Category) AS Count FROM posts;'; //PROBLEM LIES HERE IN THE SECOND ONE multiQuery += 'SELECT ID, Title, Img_path, Category, Views FROM posts WHERE Category = ' + connection