Nodejs callback function problem

  node.js, question

First, I’d like to wish you a happy New Year!Ladies and gentlemen, The New Year’s Eve of Old Lee.
Then
Code it directly

server.js

var resu;
 var db = require("./dbs.js");
 var http=require("http");
 var data = [
 'OrderNO',
 DATE_FORMAT( OrderDate, "percentage Y- percentage m- percentage d")OrderDate',
 'c.CustomName',
 '(select count(Quantity) from SalesInfo where OrderNo=s.OrderNO)Quantity',
 '(select sum(Money) from SalesInfo where OrderNo=s.OrderNO)Money',
 'OrderStatus',
 'SalesInfo as s left join Customer as c on s.CustomID=c.CustomNo',
 '1=1'
 bracket
 var server=http.createServer(function(req,res){
 if(req.url!  =="/favicon.ico"){
 db.searchDb(data,function(error,resultData){
 res.writeHead(200,{"Content-Type":"text/plain","Access-Control-Allow-Origin":"*"});
 if(error){
 //return error message
 res.write(error);
 }else{
 resu=JSON.stringify(resultData);
 res.write(resu);
 bracket
 res.end();
 });
 bracket
 
 });
 server.listen(1338,"localhost",function(){
 Log ("start listening ...");
 });

dbs.js

exports.searchDb =function (sqldata,resultCallback){
 var Mysql = require('node-mysql-promise');
 var mysql = Mysql.createConnection({
 host: 'qdm1.my3w.com',
 user: 'qdm1',
 password: '1qE',
 database:'qdm11_db'
 });
 //SELECT * FROM table;
 //mysql.table('SalesInfo').field('OrderNO,OrderDate,CustomID,Quantity,Money,OrderStatus').select().then(function (data)
 Mysql.query('SELECT DISTINCT Percent S, Percent S, Percent S, Percent S, Percent S, Percent s FROM Percent s WHERE Percent s',sqldata).then(function (data)
 bracket
 //return data;
 console.log(data);
 resultCallback(null,data);
 }).catch(function (e) {
 console.log(e);
 resultCallback(e);
 });
 bracket

The problem now is:There is no problem when clicking on the query once in the locality, and when clicking on the query button again, it will report that there is a problem with the sql sentence. . Mysql.query () reported an error here
Great God, help me see if there is something wrong with what I wrote by callback, Kneeling xie!
Add an error message

c:\Users\lenovo\WebstormProjects\bootstrap>node myserver.js
 Start listening  ...
 [ RowDataPacket {
 OrderNO: '20160127123450552',
 OrderDate: '2016-01-27',
 CustomName:' Feng Shuo',
 Quantity: 1,
 Money: 1500,
 OrderStatus: '1' },
 RowDataPacket {
 OrderNO: '20160205432183109',
 OrderDate: '2016-02-05',
 CustomName:' Yang Liu',
 Quantity: 2,
 Money: 3100,
 OrderStatus: '1' } ]
 { [Error: ER_PARSE_ERROR: You have an error in your SQL syntax;  Check the manual that correspondences to your MySQL server version for the rightsyntax to usenear 'selectdifference percentage s, percentage s, percentage s, percentage s, percentage s,  Percentage s FROM percentage s WHERE percentage s, orderno, date _ format (ordedat 'atline1)
 code: 'ER_PARSE_ERROR',
 errno: 1064,
 sqlState: '42000',
 index: 0 }

I took a cursory look on my cell phone. The problem should be try catch. I’ll take a closer look when I get home.