创建一个视图, 表A,表B, 表B中列名 X1与 表A中列名X2对应, 但表B中数据A中不一定有, 要在视图中新建一个项I,如果表A中有表B数据 则I为存在,如果没有则不存在
没完全看懂你要什么样的,但跑不出左连接,右连接,内连接的范畴。
http://www.cnblogs.com/LeoTerry/archive/2010/03/26/1696988.html
秒解决问题~十分感谢~
select x2,'存在' as ee from A where exists (select x1 from B where x2=x1)
union
select x2,'不存在' as ee from A where not exists (select x1 from B)