RethinkDB - Left join where joined_table.identifier is null? -
i have 2 tables in rethinkdb database represent one-to-many relationship. consider following 2 tables:
t1 parentid name 1 lorem 2 ipsum 3 dotor 4 sit 5 amet t2 childid parentid childname 1 1 2 3 random 3 5 here
on t1, parentid primary key, , on t2, there secondary index on parentid. want find parents don't have child. operation in sql (mssql exact) looks this:
select t1.* t1 left outer join t2 on t2.parentid = t1.parentid t2.childid null results: parentid name 2 ipsum 4 sit
how can accomplish similar result in rethinkdb? thank you!
i this:
r.table('t1').filter(function(parent) { return r.table('t2').get_all(parent('parentid'), {index: 'parentid'}).count().eq(0); })
Comments
Post a Comment