Re: [R] Using SQL "IN" with RJDBC or RMySQL

2011-10-19 Thread David Epstein
Gabor, thank you. I just got the script working using paste but your solution looks good as well. I was not familiar with gsubfn. Appears very useful. -david > With gsubfn if you preface your function with fn$ as shown below then > it turns on a quasi-perl style string interpolation: > > libr

Re: [R] Using SQL "IN" with RJDBC or RMySQL

2011-10-19 Thread Gabor Grothendieck
On Wed, Oct 19, 2011 at 12:35 AM, David Epstein wrote: > Hello, > > > The code below works fine up until I try to use the "IN" statement in > the last line. The proper SQL format is: > > SELECT * FROM this_table WHERE this_column IN (1,2,3,4,5) > > But, I think I may be getting something like: > >

Re: [R] Using SQL "IN" with RJDBC or RMySQL

2011-10-19 Thread David Epstein
thank you! I was able to get it to work with collapse="," On Wed, 2011-10-19 at 01:52 -0500, Jeff Newmiller wrote: > paste("SELECT * FROM this_table WHERE this_column IN (", > paste(org_table$id, collapse=TRUE),")",sep="") __ R-help@r-project.org maili

Re: [R] Using SQL "IN" with RJDBC or RMySQL

2011-10-18 Thread Jeff Newmiller
You are misusing SQL variable substitution. Just embed the list in the SQL statement itself. paste("SELECT * FROM this_table WHERE this_column IN (", paste(org_table$id, collapse=TRUE),")",sep="") Better yet, use a SQL join so you can do this sequence in one SQL statement. -

[R] Using SQL "IN" with RJDBC or RMySQL

2011-10-18 Thread David Epstein
Hello, The code below works fine up until I try to use the "IN" statement in the last line. The proper SQL format is: SELECT * FROM this_table WHERE this_column IN (1,2,3,4,5) But, I think I may be getting something like: SELECT * FROM this_table WHERE this_column IN c(1,2,3,4,5) Which makes