To run multiple statements in one query with node-mysql, we call the query
method.
For instance, we write
connection.query("SELECT ?; SELECT ?", [1, 2], (err, results) => {
if (err) {
throw err;
}
console.log(...results);
});
to call query
with the select statements separated by a semicolon.
the array are the values that fill the question mark placeholders.
And we get the results from the results
array.