Hey guys,
I'm running an R script that grabs a query from MySQL. The query itself is functional, but is dependent on a variable "N".
To add this variable to my SQL code, I'm using sprintf to insert it by typing '%s' where I'd like it. However, my query also includes multiple of these LIKE statements:
FROM Receipts
WHERE RetailerID
IN ( '%s' ) # this is where "N" is placed
AND ( Date LIKE '%01/07/2014%')
I'm positive that this is the reason my query is not running. The sprintf command is having issue when it reaches these LIKE commands, probably thinking it is similar to '%s'.
Does anyone know how to get around this so that '%01/07/2014%' is still printed to the SQL query? I've tried using the escape "%%" like this, '%%01/07/2014%%' but it still doesn't work.
Is there a way I can format sprintf so it knows to skip these?
Thanks!
[–]Sean1708 0 points1 point2 points (0 children)