select *
from a
where a.bh in (select bh from b where 这里怎么写的。
from a
where a.bh in (select bh from b where 这里怎么写的。
解决方案 »
- maskedit1如何处理自己的异常?
- 如何判断数据库连接成功!
- 关于integer(),这函数是怎用的,返回的是什么?
- 如何获得count返回值
- 求助:怎样把一个好的光电鼠标打造成“broken”鼠标
- 高手进来说说怎么公用的变量和自定义函数放在程序中什么位置比较好!?如果用一个单独的文件呢又存行不行?程序中的其它模块怎样调用他们
- 一个MainMenu1问题?
- 一个简单的Access2000问题,在线等。。。。
- 唉,菜!简单问题都很迷惘!
- hzb (Explorer) pazee(耙子)请到这里来,对于Formula one我这样解决行不?
- 一个弱弱的问题:如何计算datetime1与datetime2之间的时间间隔是多少分钟。
- 怎样将SQL中的一个字段的内容连格式一起加到窗体中的Memo控件中显示?
where a.bh
in (select b.bh from b where b.s1<>b.shs1)
在表B里有一条记录
bh sl shsl
5 40 Null当执行 where sl<>shsl不能得到正确的结果。加上select * from a where a.bh in (select bh from b where sl<>shsl or shsl is null)
就搞定。
where A.bh in(
select distinct bh
from B
where isnull(sl,0) <> isnull(shsl,0))
说明:1、下次给出你的DBMS,以上在MS SQL Server 2000下可行;
2、作为数据库设计,表B设计错误。
(select bh from b where sl<>shsl
and s1 is not null
and shsl is not null)没看太清楚,是不是这样?
from B
where isnull(sl,0) <> isnull(shsl,0)) a2
where a1.bh = a2.bh;
性能稍好一些。