问题
I want to execute multiple queries in one API call, but I only want to execute them conditionally based on the response of the previous one. How can I go about implementing this?
I've seen that I can do something like below to execute multiple queries.
connection.query('SELECT * ...; SELECT * ...', [1, 2], function(err, results) {
if (err) throw err;
});
But how do I await the response of the first before conditionally executing the second?
来源:https://stackoverflow.com/questions/60230245/node-mysql-multiple-statements-in-one-query-execute-conditionally-on-response-f