--测试数据:
declare @t table (物料 varchar(10), 序号 int, 工序 varchar(10))
insert into @t
select '001', 1, '木工'
union all
select '001', 2, '木工'
union all
select '001', 3, '打磨'
union all
select '001', 4, '木工'
union all
select '001', 5, '打磨'
union all
select '001', 6, '五金'
--查询:
select * from @t a where not exists(select [序号] from @t b where b.[序号] =a.[序号]+1 and b.工序=a.工序 ) and [工序]='木工'