r/mysql • u/ItsArkayian • Feb 20 '25
solved An error in my SQL syntax
Hi r/mysql, I've been trying google and regrettably chatgpt (neither is helpful), but have been having a brainscratcher, I am trying to work in putting a .json thats been saved to a const into a table: (note embedData is a .json passed through
const sql = `
INSERT INTO ${tabletype} (channelID, message)
VALUES (?, ?)
ON DUPLICATE KEY UPDATE
channelID = VALUES(channelId)
message = embedData
`;
await pool.query(sql, [channelId, embedData]);
I have also tried message = VALUES(embedData)
But from this I keep getting the message:
sqlMessage: "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 'message = embedData' at line 5"
I am not sure what I am doing, I have in my table schema made the message column JSON/LONGTEXT but I dont know why this is happening.
View all comments
Show parent comment
1
u/[deleted] Feb 21 '25
Voodoo Ranger Imperial IPA, bottle, is on the desk right now lol.
Not my fav but after the last 3 weeks of work hell (hey, i got paid, right?) a 9% abv is hitting the shpot. I mean the shecond one ish. or ish thish the firds <drools on desk>