How to include a variable in an SQL query

I'm using RMariaDB to query a MySQL database.

Does anyone know how to include an r variable (in my case a singe integer) into the query string?

Do you use it through dplyr or you send raw SQL with DBI? I didn't use RMariaDB package, so I'm not sure what interface is used.

With dplyr I'm not sure what problem you have exactly, so it'd helpful to provide short snippet of what you are trying to do to make it clear.

For raw SQL you can use something like glue package that allows you to put value of a variable inside of the string that you can then send to your DB.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.