使用 sql的 not in 的问题,请指教!在线等待 select a.* from table1 awhere not existx (select b.labid from table2 b where a.labid = b.labid) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是select * from table1 where labid not in (select distinct labid from table2 )吧 select * from table1 where labid not in (select labid from table2 ) 你的那个字段肯定可以为空。你那句,加上限制条件即可。我习惯not exists呵呵,写错了。select a.* from table1 awhere not exists (select b.labid from table2 b where a.labid = b.labid) clientdataset.commandtext 中可以传递复杂的sql语句clientdataset.commandtext = 'select * from table1 where labid not in (select labid from table2 )'; 用not exists ,not in 都可以,只是你的 a.* 出错了 A.*是对的。select a.* from table1 where labid not in (select distinct labid from table2 )就是这样,你仔细看看,肯定没错。 问题解决,现总结如下 1。使用 a.* 是对的(ms sql server) 2. 必须保证 字段名相同或者在子select 语句中使用 where 指定 (在我的程序中 两个字段名不同)另:iroi 你的分宁外开帖给你 调用存储过程向数据库中插入数据失败 关于POP3服务器接收邮件的问题? developer express inc 卸载时说已经存在更新的版本,不允许删除,请问应该如何删除呀 ADOStoredProc调用的过程,出現異常, 如何捕获這個異常?? 无边框窗体,如何通过改善SC_SIZE消息改变窗体大小。 delphi截图的问题 这样的sql语句应该怎么写?? 有關delphi7的幫助 关于主从数据库的问题——————————在线等!! 将.DFM文件转换为.TXT 打印stringgrid,为什么预览不出数据。 关于RTTI,高人请进!伴水兄,chechy... 你们在吗?
(select distinct labid from table2 )吧
你那句,加上限制条件即可。我习惯not exists
呵呵,写错了。
select a.*
from table1 a
where not exists (select b.labid
from table2 b
where a.labid = b.labid)
clientdataset.commandtext = 'select * from table1 where labid not in (select labid from table2 )';
select a.* from table1 where labid not in (select distinct labid from table2 )
就是这样,你仔细看看,肯定没错。
2. 必须保证 字段名相同或者在子select 语句中使用 where 指定
(在我的程序中 两个字段名不同)另:iroi 你的分宁外开帖给你