select a from A a1 where not exists (select 1 from table where A a2 where a1.a=a2.b)
union
select b from A a1 where not exists (select 1 from table where A a2 where a1.b=a2.a)
如果 想用sql处理 建议写存储过程,逐列比较
或者 将2行复制到excel中,自己添加一行=前面2行相减
你这个难道只比较两行么?
如果4条纪录,两两相同,你显示什么。
数据库不是表格,行没有名字,只有列(column)有列名
with t as(
select 'a' a,'b' b,'c' c from dual
union all
select 'a' a,'b1' b,'c' c from dual)
select
case when count(distinct a) over()=count(a) over() then a else '' end||
case when count(distinct b) over()=count(b) over() then b else '' end||
case when count(distinct c) over()=count(c) over() then c else '' end as res
from t