您能帮我有关此INNER JOIN的SQL查询吗?
结果返回错误
connection.query("SELECT caracavis.caracname FROM caracavis WHERE firstcaturl ='" + req.body[0].firstcatname + "' AND secondcaturl = '" + req.body[0].secondcatname + "' AND thirdcaturl = '" + req.body[0].thirdcatname + "' AND fourthcaturl = '" + req.body[0].fourthcatname + "' AND fifthcaturl = '" + req.body[0].fifthcatname + "' INNER JOIN critereproducts ON caracavis.caracname = critereproducts.nameurl", function (error, results, fields) {
if (!!error) {
console.log('erreur');
} else {
console.log(results);
// res.json(results);
};
});
最佳答案
INNER JOIN
在WHERE
之前。
SELECT caracavis.caracname
FROM caracavis
INNER JOIN critereproducts
ON caracavis.caracname = critereproducts.nameurl
WHERE ...
关于javascript - Node JS SQL查询内部联接,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46940662/