I have this column "timestamp" in table A, and I want to select all data but the last week, here is my R code but an error pop up saying "Error in function (classes, fdef, mtable) : unable to find an inherited method for function "dbWriteTable", for signature "MySQLConnection", "data.frame", "character"", any help would be appreciated? THANK YOU.
fun <- function(con, dat.set, tbl.name) {
if (dbExistsTable(con, tbl.name)) {
BFWeek = dbGetQuery(con, statement=paste("SELECT * FROM A",
"WHERE timestamp < timestampadd(day, -7, now())"))
dbWriteTable(con, BFWeek, tbl.name, row.names=F, append=T);
} else {
dbWriteTable(con, tbl.name, dat.set, row.names=F, append=T);
}
}
fun(conn_table, df, "A")