110,499
社区成员
发帖
与我相关
我的任务
分享
--> 测试数据:[TA]
if object_id('[TA]') is not null drop table [TA]
create table [TA]([url] varchar(15),[status] varchar(6))
insert [TA]
select '12521/52362.jpg','更新中' union all
select '12521/52362.jpg','己更新' union all
select '12522/55333.jpg','更新中' union all
select '12523/55334.jpg','更新中' union all
select '12523/55334.jpg','己更新'
--> 测试数据:[TB:]
if object_id('[TB]') is not null drop table [TB]
create table [TB]([url] varchar(15))
insert [TB]
select '12521/52362.jpg' union all
select '12522/55333.jpg'
select * from [TA] A
where exists(select * from [TB] where A.url=url)
and status='更新中'.
/*
url status
--------------- ------
12521/52362.jpg 更新中
12522/55333.jpg 更新中
(2 行受影响)
*/
drop table [TA]
drop table [TB]
select A.* from A where A.status='己更新' or exists(select url from B where url=A.url and status=A.status)