[R] Query an Access database based on a date attribute (Tudor Bodea)
Baize, Harold
HBaize at buttecounty.net
Tue Nov 13 17:26:06 CET 2007
Tudor Bodea asked:
>In this context, I try to get all the records for which market is atl-bos,
>competitor is delta and dd is 2007-11-20 (first record above). To do this I used
>># channel <- odbcConnectAccess("test.mdb")
>>res <- sqlQuery(channel, "select * from test_table where market = 'atl-bos'
>>and competitor = 'delta' and dd = 2007-11-20")
>Does any of you know what it is going on?
Try this:
res <- sqlQuery(channel, "select * from test_table
where market = 'atl-bos'and competitor = 'delta' and dd = {d '2007-11-20'}")
Microsoft variant of SQL has an odd date syntax. I tried a dozen things before
I found what worked.
Harold Baize, PhD
Butte County Department of Behavioral Health
Chico, CA USA
More information about the R-help
mailing list