第一张表DailyOil,字段为DayofMonth,Month,Year,EXPL,AB,......
第二表HPower,包含字段HourEnding,Day,Month,Year,MWh1,MWh2,....
我想用HourEnding,Day,Month,Year,MWh1,MWh2,EXPL,AB
创建一个新表注意第二个表作为添加时间字段,因此比油表长24倍。
R代码:
Library(sqldf)
df4 <- sqldf("SELECT HP.Month, HP.Day, HP.Year, HP.Express_Avg, HP.Platte_Avg, HP.Full_Avg, HP.CasperToGurley_Avg, HP.OgallallatoEthlyn_Avg, OD.EXPL, OD.PLATTE, OD.CASPERtoGUERNSEY
FROM HPower HP
LEFT JOIN DailyOil OD
on HP.Day = OD.DayofMonth and HP.Month = OD.Month and HP.Year = OD.Year")
Error in sqliteExecStatement(con, statement, bind.data) :
RS-DBI driver: (error in statement: near "FROM": syntax error)