LINQ - Full Outer Join

后端 未结 16 1587
既然无缘
既然无缘 2020-11-21 22:45

I have a list of people\'s ID and their first name, and a list of people\'s ID and their surname. Some people don\'t have a first name and some don\'t have a surname; I\'d l

16条回答
  •  我寻月下人不归
    2020-11-21 23:19

    I really hate these linq expressions, this is why SQL exists:

    select isnull(fn.id, ln.id) as id, fn.firstname, ln.lastname
       from firstnames fn
       full join lastnames ln on ln.id=fn.id
    

    Create this as sql view in database and import it as entity.

    Of course, (distinct) union of left and right joins will make it too, but it is stupid.

提交回复
热议问题