gpt4 book ai didi

mysql获取2个结果集的差异

转载 作者:行者123 更新时间:2023-11-29 08:27:57 25 4
gpt4 key购买 nike

所以我有两张 table 。一个称为 superIDs,其中包含“superID BIGINT”列,另一个称为 mainIDs,其中包含一个名为“subid BIGINT”的列。我知道 mainIDS 是 superID 的子集。如何查看仅在 superID 中但不在 mainID 中的行。

这是我尝试的解决方案:

SELECT * FROM atlas_comparables.superIDs WHERE NOT EXISTS
(SELECT * FROM atlas_comparables.mainIDs);

但是,这给我返回了一个空集。有什么帮助吗?

最佳答案

试试这个

   SELECT * FROM atlas_comparables.superIDs WHERE the_id_column NOT IN
(SELECT the_idcolumn_ofcomparable FROM tlas_comparables.mainIDs);

注意:the_id_column 位于 superIDs 表中the_idcolumn_ofcomparable 位于 MainIds

关于mysql获取2个结果集的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17433104/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com