I was trying to make this
L1 = {{2, 1}, {6, 4}, {8, 7}, {9, 5}};
L2 = {{2, 9}, {9, 6}};
L = Union[L2 , L1]
And I used this:
Cases[L, {{a_, _}, {b_, _}} /; a == b]
Complement[L,L2]
And this:
DeleteCases[L, MemberQ[L1, {#[[1]], _}] & /@ L2]
But, both fail. The answer must take from L1 only the elements where the first element appear in L2. For L1 and L2 above, must return
{{2,1},{9,5}}
And {6, 4} and {8, 7} must be dropped from L2!
Thanks,