I've used RPostgreSQL to connect R and postgresQL, and I'd like to insert a column into another table according to the "pid", please advise how is can be achieved using R command:
>library(RPostgreSQL)
>drv<-dbDriver("PostgreSQL")
>itemlist<- dbGetQuery(con, "SELECT * from project_budget_itemlist")
>View(itemlist)
pid item cost
1 ABC 9
2 ACB 8
3 BAC 7
3 ZZZ 6
and another tables is as follow:
>name<- dbGetQuery(con, "SELECT * from namelist")
>View(name)
pid name
1 Sally
2 Joy
3 Susan
I want to the result to be:
pid item cost name
1 ABC 9 Sally
2 ACB 8 Joy
3 BAC 7 Susan
3 ZZZ 6 Susan