D delphilove Unregistered / Unconfirmed GUEST, unregistred user! 2002-06-25 #1 关于sql的问题!有一表A,表B,现在要判断A.a,A.b,A.c三个字段是在B.a里面所有记录里面!!!!!!如果一个个都判断,比较麻烦,用什么可以快眯??>(29分)<br />多谢!!!!!!!!!!
关于sql的问题!有一表A,表B,现在要判断A.a,A.b,A.c三个字段是在B.a里面所有记录里面!!!!!!如果一个个都判断,比较麻烦,用什么可以快眯??>(29分)<br />多谢!!!!!!!!!!
N night Unregistered / Unconfirmed GUEST, unregistred user! 2002-06-25 #2 不明白你说的意思具体说说应该不难 “判断A.a,A.b,A.c三个字段是在B.a里面所有记录里面”什么意思?
D delphilove Unregistered / Unconfirmed GUEST, unregistred user! 2002-06-25 #3 比如说。 A.a,A.b,A.c三个字段的值分别是:1,2,3 而B.a里面所有记录的值分别是:1,2,3,4,5,。。。。 那我怎样判断A.a,A.b,A.c三个字段的值是在B.a里面所有记录里面
U ugvanxk Unregistered / Unconfirmed GUEST, unregistred user! 2002-06-25 #4 select count(*) from a where (a.a not in(select a from b))or(a.b not in(select a from b)or(a.c not in(select a from b)
select count(*) from a where (a.a not in(select a from b))or(a.b not in(select a from b)or(a.c not in(select a from b)
D delphilove Unregistered / Unconfirmed GUEST, unregistred user! 2002-06-25 #5 to ugvanxk: 问题是,如果我的A的字段有N个的话,每个都是这样判断的话会好麻烦的!!!!!!!!!! 我要更好的解决方法!!!!!!!!!!
F flylong Unregistered / Unconfirmed GUEST, unregistred user! 2002-06-26 #6 select count(distinct a) from b where b.a in (select a.a from a where a.a=b.a) or b.a in (select a.b from a where a.b=b.a) or b.a in (select a.c from a where a.c=b.a) 判断 count(distinct a) 的值 是否等于 A的字段的不同的数据的个数
select count(distinct a) from b where b.a in (select a.a from a where a.a=b.a) or b.a in (select a.b from a where a.b=b.a) or b.a in (select a.c from a where a.c=b.a) 判断 count(distinct a) 的值 是否等于 A的字段的不同的数据的个数