Template literals with nested backticks(`) in ES6
If you want to use an apostrophe in a string made with apostrophes, you escape it with a backslash, like this:
'\''
Similarly, if you want to use a backtick in a template literal, you have to escape it with a backslash:
`\``
See 11.8.6 Template Literal Lexical Components
A template without substitutions is defined as
NoSubstitutionTemplate ::
` TemplateCharactersopt`
where a template character is
TemplateCharacter ::
$ [lookahead ≠ { ]
\ EscapeSequence
LineContinuation
LineTerminatorSequence
SourceCharacter but not one of ` or \ or $ or LineTerminator
Therefore, `
can't be a template character unless you escape it by preceding it with \
.
From ES6 In Depth: Template strings by Jason Orendorff:
If you need to write a backtick inside a template string, you must escape it with a backslash:
`\``
is the same as"`"
.
Your query should be:
var query = `UPDATE packet
SET
\`association\` = "3485435",
\`tagname\` = "Simos"`