Question

I suspect this is very simple but couldn't work out how do it, nor find an answer on the internet. I have a table T in a data warehouse which I want to query through the R console e.g.

library(RJDBC)

query = function(date){
  paste('select * from T where date =', date, sep = ' ')
  return(query)
  }    

However, I become unstuck as query('01/01/2013') returns:

 select * from T where date = 01/01/2013

whereas I actually want it to return:

select * from T where date = '01/01/2013'

Thanks for any help. Cheers

Was it helpful?

Solution

Try it with a double quote:

query("'01/01/2013'")

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top