表t中A字段和B字段都是长度为10且含有数字字符的字符串,查找满足A中存在不等于'0'字符的位置,同时该位置B的字符等于'2'或'3'的记录。
例如 A 0010000000 B 0030000000 符合条件, A 0010100000 B 2000003000 不符合条件
SELECT * FROM t WHERE INSTR(A,"1")=INSTR(B,"2") OR INSTR(A,"1")=INSTR(B,"3");
select * from t where (stbstring(A,1,1)!=0 and (stbstring(B,1,1)=2 or stbstring(B,1,1)=3))
or (stbstring(A,2,1)!=0 and (stbstring(B,2,1)=2 or stbstring(B,2,1)=3))
or (stbstring(A,3,1)!=0 and (stbstring(B,3,1)=2 or stbstring(B,3,1)=3))
or (stbstring(A,4,1)!=0 and (stbstring(B,4,1)=2 or stbstring(B,4,1)=3))
or (stbstring(A,5,1)!=0 and (stbstring(B,5,1)=2 or stbstring(B,5,1)=3))
or (stbstring(A,6,1)!=0 and (stbstring(B,6,1)=2 or stbstring(B,6,1)=3))
or (stbstring(A,7,1)!=0 and (stbstring(B,7,1)=2 or stbstring(B,7,1)=3))
or (stbstring(A,8,1)!=0 and (stbstring(B,8,1)=2 or stbstring(B,8,1)=3))
or (stbstring(A,9,1)!=0 and (stbstring(B,9,1)=2 or stbstring(B,9,1)=3))
目前没有特别好的解决办法,表中字段的某一字段的一部分参与搜索,应该把这个字段再分细一点比较好