sql 2000 查询一个表中字段相同的值
来源:百度知道 编辑:UC知道 时间:2024/09/23 20:44:42
表pj_jg
字段1 p1fs
字段2 zzcj
查询这两个字段中相同的值
在线等
另外加个字段 zcr=0
意思就是 pj_jg 中 字段p1fs 字段zzcj值相等并且 字段zcr=0 的 命令
谢谢!!
字段1 p1fs
字段2 zzcj
查询这两个字段中相同的值
在线等
另外加个字段 zcr=0
意思就是 pj_jg 中 字段p1fs 字段zzcj值相等并且 字段zcr=0 的 命令
谢谢!!
select id,name from table03 where name in(select name from table03 group by name having count(name)>1)
select * from pj_jg p1,pj_jg p2 where p1.p1fs = p2.zzcj
and p1.zcr=0 and p2.zcr=0
select * from pj_jg where p1fs=zzcj and zcr=0
带NULL值处理的语句
SELECT A.*
FROM pj_jg A inner join pj_jg B ON isnull(A.p1fs,'')=isnull(B.zzcj,'')
WHERE isnull(A.zcr,0)=0
select * from pj_jg where p1fs=zzcj
select * from pj_jg where zcr=0
select * from pj_jg where p1fs=zzcj and zcr=0