Skip to contents

[Stable]

Run a SQL query via DBI::dbGetQuery using the format expected by glue_sql. Values from lMapping provided using the format expected by qlue_sql (e.g. strIDCol) will be replaced with the appropriate column names/values.

Usage

RunQuery(strQuery, df)

Arguments

strQuery

character SQL query to run using the format expected by glue_sql. Mapping values provided in curly braces will be replaced with the appropriate column names.

df

data.frame A data frame to use in the SQL query

Value

data.frame containing the results of the SQL query

Examples

df <- data.frame(
  Name = c("John", "Jane", "Bob"),
  Age = c(25, 30, 35),
  Salary = c(50000, 60000, 70000)
)
query <- "SELECT * FROM df WHERE AGE > 30"

result <- RunQuery(query, df)
#> Warning: no DISPLAY variable so Tk is not available
#> SQL Query complete: 1 rows returned.