表一 字段一 字段二 关健词
12 50 10001
14 14 10002
13 14 10007
15 10 10004
17 17 10006表二 字段一 字段二 关健词
12 50 10001
14 13 10002
13 14 10007
15 10 10004
17 NULL 10006求结果:
字段一 字段二 字段一 字段二 关健词
14 13 14 14 10002
17 NULL 17 17 10006求SQL语句 两表中对应的字段,值不相等的记录!
12 50 10001
14 14 10002
13 14 10007
15 10 10004
17 17 10006表二 字段一 字段二 关健词
12 50 10001
14 13 10002
13 14 10007
15 10 10004
17 NULL 10006求结果:
字段一 字段二 字段一 字段二 关健词
14 13 14 14 10002
17 NULL 17 17 10006求SQL语句 两表中对应的字段,值不相等的记录!
from 表一 a join 表二 b on a.关健词 = b.关健词 and (a.字段一 <> b.字段一 and a.字段二 <> a.字段二)
select a.字段一, a.字段二, b.字段一, b.字段二, a.关健词
from 表一 a join 表二 b on a.关健词 = b.关健词 and (a.字段一 <> b.字段一 or a.字段二 <> a.字段二)
a.字段一,
a.字段二,
b.字段一,
b.字段二,
a.关健词
from
表一 a,
表二 b
where
a.关健词=b.关健词 and (a.字段一<>b.字段一 or a.字段二<>b.字段二)
a.字段一,
a.字段二,
b.字段一,
b.字段二,
a.关健词
from
表一 a,
表二 b
where
a.关健词=b.关健词 and (a.字段一<>b.字段一 or a.字段二<>b.字段二)SET ANSI_NULLS ON
from 表一 a full join 表二 b on a.关健词 = b.关健词 and (a.字段一 <> b.字段一 and a.字段二 <> a.字段二)
from 表一 a ,表二 b where a.关健词 = b.关健词 and ((a.字段一 <> b.字段一 or a.字段二 <> a.字段二) or a.字段一 is null or b.字段一 is null or a.字段二 is null or b.字段二 is null)