|
发表于 2020-6-7 18:30:01
|
显示全部楼层
create table A(ID int, TITLE nvarchar(10))
insert A select 1, '诺基亚'
union all select 2, '摩托罗拉'
union all select 3, '西门子'
create table B(PRODUCT_ID int, TITLE varchar(10), 品牌ID int)
insert B select 1, '3310', 1
--1
select * from A
where ID not in
(select distinct 品牌ID from B)
--2
select * from A as A
where not exists(select 1 from B where 品牌ID=A.ID)
|
|