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

有帮助吗?

解决方案

Try it with a double quote:

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

HTH

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top