Hi,

On 3/7/07, j.joshua thomas <researchjj@gmail.com> wrote:
>
> I have used RODBC to get the database i can view the tables in RGUI-2.4.1
> how can i query the records in R>
> i tried with sqlQuery
>
> need some help
>
> A bit of code showing what you did would help others to track down what
may have gone wrong.
Nevertheless, this is code I used under R 2.3.1 on WinXP:
library(RODBC)
myaccessDB <- "c:/data/db1.mdb"
connectedMSAcc <- odbcConnectAccess(myaccessDB)
sqlTables(connectedMSAcc) # all the tables in the Access DB
onetable <- sqlFetch(connectedMSAcc, "lexp") # fetching one table called
'lexp'
myQuery <- "SELECT Country, y2001 FROM lexp WHERE y2001 > 82;"
myresults <- sqlQuery(connectedMSAcc, myQuery)
myresults


I hope this helps?

Best,
Roland

	[[alternative HTML version deleted]]

