title: How to use a variable name in a SQL statement?
body: <p>I'm using R to call a mySQL statement, where I define the variable outside the statement e.g.</p>
  
  <pre><code>foo = 23;
  dbGetQuery(con, "select surname from names WHERE age = '.foo.' ;")
  </code></pre>
  
  <p>But this returns an empty set, I've googled around and tried'.&amp;foo.'   ".foo."   '".&amp;&amp;foo."' 
   and many different combinations, but none of them work, I think this should be a mysql question rather than an R specific problem I'm having, but not sure.  Normally variables have $values but not in R.</p>