我想用R链接数据库下载数据,使用下面的code
data=sqlQuery(conn,
"select
F2_5004 as 日期
,F15_5004 as 市净率
from tb_object_5004,tb_object_1090
where F2_5004>'20100101' and F2_1090='600000' and F2_1090=F1_5004"
)
a<-'20100101'
b<-'600000'
data=sqlQuery(conn,paste("select F2_5004 as 日期 ,F15_5004 as 市净率 from tb_object_5004,tb_object_1090 where F2_5004>",a,"and F2_1090=",b,"and F2_1090=F1_5004")
)
a<-'20100101'
b<-'600000'
data<-sprintf("select
F2_5004 as 日期
,F15_5004 as 市净率
from tb_object_5004,tb_object_1090
where F2_5004>'%s' and F2_1090='%s' and F2_1090=F1_5004",a,b
)%>%sqlQuery(conn,.)