VB中使用SQL语句的问题
视图名称叫VIEWECN ecn_num stat orig req_data CreatedBy Expr1 Expr3 Expr7 Expr9 Expr10
4 C 2009-8-17 abc 4 2 25 1230000005 A
4 C 2009-8-17 abc 4 3 10 C000001247 N
4 C 2009-8-17 abc 4 4 5 C000001262 N
4 C 2009-8-17 abc 4 5 5 C000000001 A
4 C 2009-8-17 abc 4 6 10 C000001262 A
5 C ll 2009-8-17 abc 5 1 15 C000001251 A
5 C ll 2009-8-17 abc 5 2 15 C000001251 A
6 R 66 2009-8-17 abc 6 1 15 Z000000005 H
7 C mark 2009-8-19 Mark 7 1 5 C000000001 A
8 C 2009-8-19 Mark 8 1 5 C000000001 A
9 C d 2009-8-19 Demo 9 1 10 C000000002 A
9 C d 2009-8-19 Demo 9 2 5 Test000201 A
10 C mn 2009-8-19 Demo 10 1 10 C000000003 A
11 C 2009-8-19 Mark 11 1 5 Test000201 A
12 A d 2009-8-21 Mark 12 1 10 JOB0908001 A
13 C 12 2009-8-21 Mark 13 1 5 C000000001 A
13 C 12 2009-8-21 Mark 13 2 5 C000000001 A
14 R hh 2009-8-21 Mark 14 1 10 C000000001 N
16 C d 2009-8-22 Mark 16 1 5 C000000001 A
17 C ww 2009-8-22 Mark 17 2 10 C000000002 A
19 R ykj 2009-8-24 Mark 19 1 12 1230000005 A
19 R ykj 2009-8-24 Mark 19 2 20 C000000002 N
22 R 2009-8-26 ZhouJing 22 1 30 P123456799 A
22 R 2009-8-26 ZhouJing 22 2 10 P123456799 R
23 R 2009-8-26 ZhouJing 23 1 30 P123456799 A
23 R 2009-8-26 ZhouJing 23 2 30 P123456799 A
24 R 2009-8-27 ZhouJing 24 1 10 zz00000001 A
24 R 2009-8-27 ZhouJing 24 2 10 zz00000001 A
25 R 2009-8-27 ZhouJing 25 1 10 zz00000001 R
25 R 2009-8-27 ZhouJing 25 2 15 zz00000001 A
26 R 2009-8-27 ZhouJing 26 1 10 C000001242 A
26 R 2009-8-27 ZhouJing 26 2 15 C000001242 A
27 R 2009-8-27 ZhouJing 27 1 10 C000001242 A
27 R 2009-8-27 ZhouJing 27 2 15 C000001242 A
28 R 2009-8-27 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
数据库表.rar
(3.74 KB)