First table DailyOil with the fields DayofMonth, Month, Year, EXPL, AB,…
Second Table HPower with the fields HourEnding, Day, Month, Year, MWh1, MWh2, ….
I want to create a new table with HourEnding, Day, Month, Year, MWh1, MWh2, EXPL, AB
Notice the second table as an addition time field so is 24 times long than the oil table.
The R code:
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)