¿Alguien sabe cómo usar SELECT WHERE IN
en node-mysql?SELECCIONE DONDE IN en node-mysql
he probado el código de abajo, pero me sale el siguiente mensaje de error:
'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''(`PHP`,`apache`)'' at line 1'
Este es mi código:
whereIn = '(';
for (var i in tagArray) {
if (i != tagArray.length - 1) {
whereIn += "`" + tagArray[i] + "`,";
}else{
whereIn += "`" + tagArray[i] + "`";
}
}
whereIn += ')';
console.log(whereIn);
client.query(
'SELECT tag_id FROM tag WHERE tag_name IN ?',
[whereIn],
function(err, result, fields) {
client.destroy();
if (err) {
throw err;
}
console.log(result);
res.redirect('/');
}
);
¿No le encantan los mensajes de error de SQL? Soooo0o0o0oo helpful – lbstr