使用 UNION 時它會排除重複資訊,這點跟 CONCAT 很不一樣,
所以我比較常用 UNION 。
至於聯集、交集跟差集我該解釋他們是什麼嗎?
恩...我在下面註記了下,希望有點幫助 XDDDD
UNION(聯集): a 或 b
(From a In dt1.AsEnumerable Select New With {.ID = a.Item("ID")})
.Union
(From b In dt2.AsEnumerable Select New With {.ID = b.Item("ID")})
INTERSECT(交集): a 且 b
(From a In dt1.AsEnumerable Select New With {.ID = a.Item("ID")})
.Intersect
(From b In dt2.AsEnumerable Select New With {.ID = b.Item("ID")})
EXCEPT(差集): a - b
(From a In dt1.AsEnumerable Select New With {.ID = a.Item("ID")})
.Except
(From b In dt2.AsEnumerable Select New With {.ID = b.Item("ID")})
沒有留言:
張貼留言