两表的联合查询有关问题

两表的联合查询问题现在有表A与表B:表AIdUserValue1aa32bb63cc24dd35ee1表BUIdValue1325321754要获取表A的

两表的联合查询问题
现在有表A与表B:

表A
IdUserValue
1aa3
2bb6
3cc2
4dd3
5ee1

表B
UIdValue
13
25
32
17
54

要获取表A的的数据,条件A.Id <> B.UId And A.Value <> B.Value(同一记录),这样的查询怎样写效率高?



[解决办法]

SQL code
--05select id,value from aexceptselect uid,value from b-----orselect *from a twhere not exists (select 1 from b where uid = t.id or value = t.value)
[解决办法]
SQL code
select A.* from Ainner join B on A.Id<>B.UId and A.Value <> B.Value
[解决办法]
SQL code
select *from awhere not exists (select 1 from b where uid = a.id or value = a.value)
[解决办法]

select * from A where not exists( 
A.ID=B.UID and A.value=B.value)