有一张表A,属性id,name,extend,其中extend字段为空,一张表C,属性id ,extend,c.extend不为空, 其中表C.id是表A.id子集。现在需要使用SQL实现这样的功能 如果A.id = C.id 那么 a.extend = c.extend 否则 a.extend = 0 ? select a.id,a.name,a.extend from a,c where a.id=c.id and a.extend = c.extend union all select a.id,a.name,a.extend from a,c where a.extend = 0 and not exists(select 1 from c where a.id=c.id) select A.id,nvl(A.extend,0) from A,C where A.id = C.id(+) 对,用nvl的,楼主明白的