I have stumbled upon an interesting challenge. I have data in a SQL Server table with the following format/content.
Date | Name
---------+---------
1/1/2010 | John
1/1/2010 | Mark
1/1/2010 | Peter
1/1/2010 | Mia
2/4/2010 | John
2/4/2010 | Billy
I am trying to convert that table into a file containing edges of a graph.
I'll need the edges file to have to columns and all the combinations that the table shows.
John | Mark
John | Peter
John | Mia
Mark | Mia
Mark | Peter
Peter | Mia
John | Billy
I suspect part of this can be achieved with pivot/unpivot but don't know how to proceed with limiting the pivot to only two columns.
Also, I don't know how to make sure I get all the possible combinations of nodes, see that the first four 'nodes' need to become six 'edges.'