主题:VB中使用sql语句的问题
视图名称叫VIEWECN
ecn_num stat CreatedBy Expr1 Expr3 Expr7 Expr9 Expr10
4 C abc 4 2 25 1230000005 A
4 C abc 4 3 10 C000001247 N
4 C abc 4 4 5 C000001262 N
4 C abc 4 5 5 C000000001 A
4 C abc 4 6 10 C000001262 A
5 C abc 5 1 15 C000001251 A
5 C abc 5 2 15 C000001251 A
6 R abc 6 1 15 Z000000005 H
7 C Mark 7 1 5 C000000001 A
8 C Mark 8 1 5 C000000001 A
9 C Demo 9 1 10 C000000002 A
9 C Demo 9 2 5 Test000201 A
10 C Demo 10 1 10 C000000003 A
11 C Mark 11 1 5 Test000201 A
12 A Mark 12 1 10 JOB0908001 A
13 C Mark 13 1 5 C000000001 A
13 C Mark 13 2 5 C000000001 A
14 R Mark 14 1 10 C000000001 N
16 C Mark 16 1 5 C000000001 A
17 C Mark 17 2 10 C000000002 A
19 R Mark 19 1 12 1230000005 A
19 R Mark 19 2 20 C000000002 N
22 R ZhouJing 22 1 30 P123456799 A
22 R ZhouJing 22 2 10 P123456799 R
23 R ZhouJing 23 1 30 P123456799 A
23 R ZhouJing 23 2 30 P123456799 A
24 R ZhouJing 24 1 10 zz00000001 A
24 R ZhouJing 24 2 10 zz00000001 A
25 R ZhouJing 25 1 10 zz00000001 R
25 R ZhouJing 25 2 15 zz00000001 A
26 R ZhouJing 26 1 10 C000001242 A
26 R ZhouJing 26 2 15 C000001242 A
27 R ZhouJing 27 1 10 C000001242 A
27 R ZhouJing 27 2 15 C000001242 A
28 R ZhouJing 28 1 15 zz00000001 A
其中我要Expr10 的值有四种情况A、N、R、H,我要让每行都是A、N的现实出来,只要有R、H的就不显示
我现在的问题就是那个ecn_num是22和25的,他的行里Expr10的值有一个是不满足条件用了我的语句还是会显示出来,我现在是要不管22的和25的有多少条,只要有一条不满足,这个22或25就不显示,这语句该怎么写,我想了半天也没想出来,我只知道我的那个语句只要有一个成立就会显示,反过来我就想不出怎么弄了,请指教啊!(还有,这个是在vb6中做的一个东西)
rs.Open "select DISTINCT ecn_num from VIEWECN where Expr10<>'R' and Expr10<>'H' and (Expr10='A' or Expr10='N')", cn, adOpenStatic, adLockReadOnly
ecn_num stat CreatedBy Expr1 Expr3 Expr7 Expr9 Expr10
4 C abc 4 2 25 1230000005 A
4 C abc 4 3 10 C000001247 N
4 C abc 4 4 5 C000001262 N
4 C abc 4 5 5 C000000001 A
4 C abc 4 6 10 C000001262 A
5 C abc 5 1 15 C000001251 A
5 C abc 5 2 15 C000001251 A
6 R abc 6 1 15 Z000000005 H
7 C Mark 7 1 5 C000000001 A
8 C Mark 8 1 5 C000000001 A
9 C Demo 9 1 10 C000000002 A
9 C Demo 9 2 5 Test000201 A
10 C Demo 10 1 10 C000000003 A
11 C Mark 11 1 5 Test000201 A
12 A Mark 12 1 10 JOB0908001 A
13 C Mark 13 1 5 C000000001 A
13 C Mark 13 2 5 C000000001 A
14 R Mark 14 1 10 C000000001 N
16 C Mark 16 1 5 C000000001 A
17 C Mark 17 2 10 C000000002 A
19 R Mark 19 1 12 1230000005 A
19 R Mark 19 2 20 C000000002 N
22 R ZhouJing 22 1 30 P123456799 A
22 R ZhouJing 22 2 10 P123456799 R
23 R ZhouJing 23 1 30 P123456799 A
23 R ZhouJing 23 2 30 P123456799 A
24 R ZhouJing 24 1 10 zz00000001 A
24 R ZhouJing 24 2 10 zz00000001 A
25 R ZhouJing 25 1 10 zz00000001 R
25 R ZhouJing 25 2 15 zz00000001 A
26 R ZhouJing 26 1 10 C000001242 A
26 R ZhouJing 26 2 15 C000001242 A
27 R ZhouJing 27 1 10 C000001242 A
27 R ZhouJing 27 2 15 C000001242 A
28 R ZhouJing 28 1 15 zz00000001 A
其中我要Expr10 的值有四种情况A、N、R、H,我要让每行都是A、N的现实出来,只要有R、H的就不显示
我现在的问题就是那个ecn_num是22和25的,他的行里Expr10的值有一个是不满足条件用了我的语句还是会显示出来,我现在是要不管22的和25的有多少条,只要有一条不满足,这个22或25就不显示,这语句该怎么写,我想了半天也没想出来,我只知道我的那个语句只要有一个成立就会显示,反过来我就想不出怎么弄了,请指教啊!(还有,这个是在vb6中做的一个东西)
rs.Open "select DISTINCT ecn_num from VIEWECN where Expr10<>'R' and Expr10<>'H' and (Expr10='A' or Expr10='N')", cn, adOpenStatic, adLockReadOnly