Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Example Input Table:
<pre>
Unit   Name         Phone     Address        Email
200    Joe Bloggs   555-1234  15 Sea Lane    owner1@example.com
200    Jane Bloggs  555-1235  15 Sea Lane    owner2@example.com
201    Peter Parker 555-1236  12 James St    owner3#example.com
202    James Kent   555-1237  99 Campbell St owner4@example.com


Example Output Table:
Key    Name1        Phone1    Address1       Email1               Name2        Phone2    Address2       Email2
200    Joe Bloggs   555-1234  15 Sea Lane    owner1@example.com   Jane Bloggs  555-1235  15 Sea Lane    owner2@example.com
201    Peter Parker 555-1236  12 James St    owner3#example.com   NULL         NULL      NULL           NULL
202    James Kent   555-1237  99 Campbell St owner4@example.com   NULL         NULL      NULL           NULL


What I have tried:

I tried a JOIN on the same table, but got stuck at creating and using a new unique column set every time there is a duplication in key value. Anny suggestions appreciated.
Posted
Updated 14-Feb-21 7:22am

1 solution

Have you tried using SELECT DISTINCT? See here: Eliminating Duplicates from a Self-Join Result | Handling Duplicates[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900