日期:2014-05-16  浏览次数:20620 次

数据查询问题
有表A,表B.查询当表B没有符合表A的存在记录!而我又想保留表B的字段该如何查询?

------解决方案--------------------
select B.* from B where not exists (select 1 from A where A.col = B.col);
------解决方案--------------------
SQL code
或ID為主健
select * from A where ID not in(select ID from B)

go
如果結構相同

select * from A
minus
select * from B