我有两张桌子:
创建表 Foo( 标识 VARCHAR, 数据 VARCHAR ); 创建表栏( 标识 VARCHAR, foo_id VARCHAR );
当我运行查询时:SELECT * FROM Foo WHERE id='EB7AB72D7802D1146B72E3F1D761BFA2382BE102' AND id NOT IN (SELECT foo_id FROM Bar)
我没有得到任何结果。
但是,如果我将查询更改为SELECT * FROM Foo WHERE id='EB7AB72D7802D1146B72E3F1D761BFA2382BE102' AND id NOT IN (SELECT foo_id FROM Bar WHERE foo_id IS NOT NULL)
我得到正确的结果。
表中的数据类似于以下内容:
福: 10AF193A2C0465B6DAD69C4E9E2BF86321961434,等等 10AF193A2C0465B6DAD69C4E9E2BF86321961434, 布鲁 ED724BB8F46596A8F14B891DE4B6BE5ADB0B5903,fdsj ED724BB8F46596A8F14B891DE4B6BE5ADB0B5903,fdsjio EB7AB72D7802D1146B72E3F1D761BFA2382BE102,巴兹 酒吧: 0009546DA32EFB77CB29F21E7399A8242866BBC1, 10AF193A2C0465B6DAD69C4E9E2BF86321961434 B732EA74329257213D7076F7672CCD8B1DF8E41B,(空) 7A6752AFAD1F7A887127A38937C15729673EF25F,ED724BB8F46596A8F14B891DE4B6BE5ADB0B5903