取出name = 'a'的行,并取出该行的上一行数据?请问sql server怎么写?感谢
with table1 as(
select * from table where name='a'
)
select t.* from table t
left join table1 t1 on t1.rank-1=t.rank
where t1.rank-1=t.rank
union all
select * from table1