I need to join two tables in such way that in the output I have an UNION of:

* INNER JOIN of matching records
* CARTESIAN of those which does not match (**excluding the records above, i.e. those that match**)
Maybe this looks like a piece of cake, but I need to do it in an efficient way (for far more complex query than this below).

a: 1|2|3|5
b: 2|3|4|6

result: (2,2)|(3,3)|(1,4)|(1,6)|(5,4)|(5,6)

Any helpful tricks you could advise? (I work on SQL Server 2012)
Thanks!