Вопрос

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