I have never used the data.table package. I am trying to do the following SQL left join in R create table all as select a.* from dates b left outerjoin activitycount a on a.tdate=b.tdate and a.activity=b.activity I found the following example but cannot figure out the syntax: le <- Y[X] mallx <- merge(X,Y, all.x = T) # the column order is different so change to be the same as `merge` setcolorder(le, names(mallx)) identical(le,mallx) # [1] TRUE Can anyone help? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Left-join-in-R-tp4663018.html Sent from the R help mailing list archive at Nabble.com.