I have this SQL statement:
var sql = UPDATE tableName SET ? = ? WHERE ? = ?";
db.query(
sql,
[asset.getColOne(), asset.getValOne(), asset.getColTwo(), asset.getValTwo()],
callback
);
and
{
"colOne": "colName",
"valOne": 1,
"colTwo": "colName",
"valTwo": 0
}
But when I try to execute this, I get a syntax error stating that my SQL statement is:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''colName' = 1 WHERE 'colName' = 0' at line 1
Is there any way to specify column names or overcome the single quote? Thanks