日期:2014-05-18  浏览次数:20517 次

2列数据对比要怎么写代码啊
一个表里有A,B   2列格式一样的数据,把B列数据依次在A列中查找,如果能找到的就不要,不能找到的按顺序写入c列或者新表的一列

这个代码怎么写啊

------解决方案--------------------
select B from test as t--加一个别名
where not exists(select * from test where A=t.B)--嵌套t.b 为t表的b没有对应所以有无效提示
------解决方案--------------------
楼上漏加了表别名
select B from test t where not exists(select * from test where A=t.B)