[请教]union或者union all之后的结果怎么进行排序并且按照rowid查找?
[请教]union或者union all之后的结果怎么进行排序并且按照rowid查找?
在线关注。
[解决办法]
declare @rowid int set @rowid=2select * from (select * from aunion allselect * from b) aa where rowid=2 order by 排序列
[解决办法]
-----------sql中没有rowid,oracle中才有的。-----------sql中的行号是,row_numberselect * from (select rowid=row_number() over(order by xh),* from(select * from goalunion allselect * from goal )tmp)tmp2 where rowid=1