34,575
社区成员
发帖
与我相关
我的任务
分享
declare @a table(pid int,type varchar(10))
declare @b table(pid int,type varchar(10))
insert @a
select 1,'南京' union all
select 2,'无锡' union all
select 3,'镇江'
insert @b
select 1,'shop' union all
select 1,'www ' union all
select 3,'shop'
select a.pid,b.type from @a a
left join @b b
on a.pid=b.pid and b.type='shop'
/*
pid type
1 shop
2 null
3 shop
*/