34,588
社区成员
发帖
与我相关
我的任务
分享
select
*
from
a left join b
on
a.p_id = b.p_id and a.p_color = b.p_color and a.p_size = b.p_size
where
a.p_id is not null---连接字段加索引。
select * from a where exists(select 1 from b where p_id=a.p_id and (p_color<>a.p_color or p_size<>a.p_size))
--1
select * from a left join b
on a.p_id = b.p_id and a.p_color = b.p_color and a.p_size = b.p_size
where a.p_id is not null
--2
select * from a
where not exists(select 1 from b
where p_id=a.p_id and p_color=a.p_color and p_size=a.p_size)
--3
select * from a except select * from b
--4
select * from a checksum(p_id,p_color,p_size) not in(select p_id,p_color,p_size from b)
select p_id,p_color,p_size from a
where checksum(p_id ,p_color , p_size) not in (select checksum(p_id, p_color , p_size) from b)
binary_checksum 或用 checksum
select p_id,p_color,p_size from a
where not exists (select p_id + p_color + p_size where (p_id + p_color + p_size)=(a.p_id + a.p_color + a.p_size))
select p_id,p_color,p_size from a
where not exists (select p_id + p_color + p_size where (p_id + p_color + p_size)<>(a.p_id + a.p_color + a.p_size))
select p_id,p_color,p_size from a where not exists(select 1 from b where p_id<>a.p_id and p_color<>a.p_color and p_size<>a.p_size)