I have a table with such data:
[ID, Name] 1, Bob 1, Joe 1, Joe 1, Bob
I want to get a list of records showing the relationship between records with the same ID. For example, I want to get the following result from my query:
Bob, Joe Joe, Bob Bob, Bob Joe, Joe
This shows me the "from" and "to" for each element of the table.
I can get this result using the following query:
SELECT DISTINCT [NAME] FROM TABLE A INNER JOIN TABLE B ON A.ID = B.ID
Is there anyway for me to achieve the same set of results without using the "distinguishing" in the select statement? If I do not include the report, I get 16 records, not 4.
source share