A
aahben
Unregistered / Unconfirmed
GUEST, unregistred user!
有a,b,c三个表,都有字段DD,我要在条件中加入当任意两个表的DD字段不为空时要求相等,帮我看看该怎么办,我的大致意思如下select a.a1,b.b2,c.c3 from a,b,c where 1=1 and when a.a1 is not null and b.b2 is not null then a.dd=b.ddwhen a.a1 is not null and c.c3 is not null then a.dd=c.ddwhen b.b2 is not null and c.c3 is not null then b.dd=c.ddwhen a.a1 is not null and b.b2 is not null and c.c3 is not null then a.a1=b.b2 and a.a1=c.c3