r sqldf escape double quotes

Viewed 2072

I wish to run the following sql statement within sqldf():

select columnA, "new_column_value" as columnB, "column.C" from mytable
where columnA in ('123','456')

but when I run within sqldf :

sqldf('select columnA, "new_column_value" as columnB, "column.C" from mytable
    where columnA in ('123','456')')

I get the obvious error that the single quotes have escaped the sql code at in('123','456'), and if I wrap the sql code with double quotes, the sql is escaped where I create a new column "new_column_value" or when I select via literal string from the unhelpfully named "column.C".

So I am in a bit of a catch 22. It's almost as if I want to wrap by sql code in something other than quotes within the sqldf() call.

Can I escape both single and double quotes where I please?

2 Answers
Related