Update query in sqldf returns 0 rows 0 columns

97 views Asked by At

I am trying to update a column in a table and I am using sqldf update query for it.

the column has values like-'within few hours','few hours','N/A'..... I want to update it with numbers for each label. i.e: 1 for 'within few hours' and so on.

The r statement i am using is-

dfHost_Response_Time2= sqldf("select host_response_time    
                              from dfHost_Response_Time  
                              where host_response_time='within a few hours'")   

oldname="within a few hours"  
newname="1" 



sqldf("update dfHost_Response_Time2  
       set host_response_time='%$newname%'  
       where host_response_time='%$oldname%'",  
       "select host_response_time from dfHost_Response_Time2")   

I am getting 0 rows 0 columns after running query. Can anyone help me out in this one?

0

There are 0 answers