title: Error in your SQL syntax SET Syntax, how to solve?
body: <p>While on the Lambda function, I'm trying to run the query below, but it throws an ER_PARSE_ERROR error:</p>
  <pre><code>{
  
    &quot;errorType&quot;: &quot;Error&quot;,
  
    &quot;errorMessage&quot;: &quot;ER_PARSE_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 'SELECT DISTINCT A.j FROM ...' at line 1&quot;,
  
    &quot;trace&quot;: [
  
  </code></pre>
  <pre><code>const vandium = require('vandium');
  
  var mysql = require('mysql');
  var connection = mysql.createConnection({ multipleStatements: true });
  
  exports.handler = vandium.generic()
      .handler((event, context, callback) =&gt; {
  
          var connection = mysql.createConnection({
              host: 'xjxj',
              user: 'xjxj',
              password: 'xjxj',
              database: 'xjxj'
          });
          var x = connection.escape(event.x);
          var y= connection.escape(event.y);
          var z = connection.escape(event.z);
    connection.query(&quot;SET @&quot;+y+&quot;=2; SELECT DISTINCT A.j FROM A INNER JOIN B, C WHERE A.j = B.j and C.x= &quot; + x + &quot; and C.y=&quot;+y+&quot;  and C.z= &quot; + z + &quot;&quot;, function (error, results, fields) {
              if (error) {
                  connection.destroy();
                  throw error;
              }
              else {
                  console.log(results);
                  callback(null, results);
              }
          });
      });
  
  </code></pre>
  <p>I also thought of something like:
  <code>... &quot;SET @y=2;...&quot; </code> but negative</p>
  <p>I'm trying to implement something on similar lines:</p>
  <pre><code>SET @y := @k :=79;SELECT DISTINCT A.j FROM A INNER JOIN B, C WHERE A.j = B.j and C.x= &quot; + x + &quot; and C.y=&quot;+y+&quot;  and C.z= &quot; + z + &quot;
  </code></pre>
  <p>Of course, there's no k in the first code block, but here's the rough idea.</p>
  <p>What went wrong?</p>