There is no difference, the same query structure is in the both cases:
"6683"
"character"
"character"
"select * from students where student_id = 6683 order by date_time"
"4738D"
"character"
"character"
"select * from students where student_id = 4738D order by date_time"
and still is the same error
thanks, Jeff,
good point... I'll try that
On Tue, Sep 17, 2013 at 9:43 AM, Jeff Newmiller wrote:
> Why don't you print the 'query' variable with each id value and consider
> what the SQL syntax is for number and string literals. Then study the use
> of escaping in strings ("\\") to fix the quer
Why don't you print the 'query' variable with each id value and consider what
the SQL syntax is for number and string literals. Then study the use of
escaping in strings ("\\") to fix the query.
---
Jeff Newmiller
Yes, you are right... the other is definitely not a valid query.
thanks
On Tue, Sep 17, 2013 at 11:22 AM, Jeff Newmiller
wrote:
>
> id <- c("21328","78789D")
>>
>> query <- paste(paste("select * from tbl_user where student_id = ",
>>
> id,sep=""), " order by date_time", sep="")
>
>> query
>>
>
id <- c("21328","78789D")
query <- paste(paste("select * from tbl_user where student_id = ",
id,sep=""), " order by date_time", sep="")
query
[1] "select * from tbl_user where student_id = 21328 order by date_time"
[2] "select * from tbl_user where student_id = 78789D order by date_time"
No
Hi,
when I generate query using sqldf library, like this:
query = paste(paste("select * from tbl_user where student_id = ", id,
sep=""), " order by date_time", sep="")
student <- sqldf(query)
everything works fine in case the id is "21328", "82882", or something like
that. But, w
Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf
> > Of srecko joksimovic
> > Sent: Tuesday, September 17, 2013 9:04 AM
> >
Maybe you should escape the single quotes something like " ' " id " ' "?
On Sep 17, 2013, at 6:03 PM, srecko joksimovic
wrote:
> Hi,
>
> when I generate query using sqldf library, like this:
> query = paste(paste("select * from tbl_user where student_id = ", id,
>sep=""), " ord
id
with
"\"", id, "\""
and you may get a query that works.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of srecko joksimovi
9 matches
Mail list logo