使用SQLite从两个具有共同条目的列中查找值组

使用SQLite从两个具有共同条目的列中查找值组

本文介绍了使用SQLite从两个具有共同条目的列中查找值组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含三列的表,例如:

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由于它们共享节点(通过节点25 9连接)而属于一起.EID 34 40因为它们共享节点而彼此在一起(通过节点6连接).EID 45是单独存在的,因为它不与任何其他EID共享任何节点.新表应如下所示:

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        #

我的一般问题是:是否可以在SQLite中执行此操作,还是应该使用其他程序例程对数据库的外部"进行这种排序?

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?

推荐答案

答案是,在SQLite中不可能如CL所述.谢谢.一个针对该问题的TCL解决方案发布在.感谢他!

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!

这篇关于使用SQLite从两个具有共同条目的列中查找值组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 22:46