简体   繁体   中英

DPLYR SQL Left Join

I have this one from SQL but i don't know how to deliver with dplyr in R. I try but the column that I hope not like that

select a.*, b.*, c.FLAG, c.MONTH, c.DATE from APPLICATION a 
left join CURL b on a.NO = b.NO 
left join WO c on a.NO = c.NO

Can you fixed this?

ab <- APPLICATION %>% left_join(CURL, by = c("NO" = "NO")) %>% 
                      left_join(WO , by = c("NO" = "NO"))  %>%
                      select(names(APPLICATION), names(CURL), FLAG, MONTH, DATE)

If the column you are joining on has the same name NO, you need not write by=c('NO'='NO') . Just by='NO' should be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM