LINQ - How to select with subquery -
LINQ - How to select with subquery - my info is: +-----+--------+-----------+ | id | name | parentid | +-----+--------+-----------+ | 1 | | 0 | | 2 | b | 0 | | 3 | c | 1 | +-----+--------+-----------+ how c if have parentid = 0 linq? assuming "categories" collection name, think need. var parentcategoryids = collections.where(c => c.parentid == 0).select(c => c.id); var results = collections.where(c => parentcategoryids.contains(c.parentid)); and if want name, can do var names = results.select(r => r.name); these 3 statements written 1 linq statement did clarity. linq