Friday, September 11, 2009
Left join in LINQ
In SQL:
SELECT * FROM table_A LEFT JOIN table_B WHERE table_A.col=table_B.col
In LINQ:
from a in table_A
join b in table_B on a.col equals b.col into temp
from finalSet in temp.DefaultIfEmpty()
hightlighted is the keywords that using left join in linq
seems using a temp dataset the set the record and fill the missing part in table_B with empty to get the finalSet.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment