Finding groups of values from two colums which hav

2019-08-17 03:51发布

I have a table with three columns eg:

EID   #   Node1   #   Node 2
----------------------------
50    #    23     #    25
34    #    6      #    11
78    #    25     #    9 
45    #    2      #    45
39    #    12     #     9
40    #    6      #     2    

EID 50 78 39 Belong together because they share nodes (Connected via nodes 25 9). EID 34 40 Belong together because they share nodes (Connected via node 6). EID 45 is alone because it does not share any nodes wit any other EID. The new table should look like this:

CF   #   EIDs       #
---------------------
1    #    50 78 39  #
2    #    34 40     #
3    #    45        #

My general question is: Is there a way to do this in SQLite, or should I do this kind of sorting "outside" of the DB using some other program routine?

1条回答
神经病院院长
2楼-- · 2019-08-17 04:37

Answer is, it is not possible in SQLite as CL mentioned. Thanks. A TCL solution to the problem is posted at Grouping dictionary keys whos values (sublist) have entries in common by Hoodiecrow. Thanks to him for that!

查看更多
登录 后发表回答