I have two tables like this:
Date Client Amount | table x
123 abc 123
456 abc 987
234 xyz 567
Date Client Amount | table y
123 abc 234
921 lka 981
234 xyz 123
In my query, I want to display:
123 abc 123 | (from x)
123 abc 234 | (from y)
234 xyz 567 | x
234 xyz 123 | y
Leaving out all records without a “partner.” Is this possible in TSQL?
An alternative to the accepted solution.
Note that where you have multiple matches from either/both tables, all the results from ‘x’ will be listed before the matches from ‘y’. e.g.