mysql - How to use a variable name in a SQL statement? -


I am using R to call a mySQL statement, where I define the variable eg.

  foo = 23; DbGetQuery (choose conn, "name by name, where age = '.foo.';")  

but it gives an empty set, I have googled around and tried it. & Amp; Foo '".foo." '' & Amp; Amp; & Amp; Efu "'And many different combinations, but none of them works, I think it should be a mysql question rather than an RS-specific problem, but this is not definitive. Generally the variable is $ values, but R

This should work:

  fu = 23 ; SqlStatement & lt; - Paste ("Choose the nickname by name, where age =", foo, '' ', sep = "") dbGetQuery (con, sqlStatement;)  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -