有三个表的union all联合查询,(ID肯定有重复)select * from ( select ID,name,RANK from a union all select ID,name,RANK from b union all select ID,name,RANK from c) as tb--我想对其进行分页,排序字段为RANK(有重复),排序规则为desc,请问该如何解决排序字段有重复的问题(注:没有一个字段是唯一的)?--如果排序字段RANK为唯一的话,sql我是这样写的,这样可以实现--第一页
select top 10 * from ( select ID,name,RANK from a union all select ID,name,RANK from b union all select ID,name,RANK from c) as tb order by tb.RANK desc--其他页
select top 10 * from ( select ID,name,RANK from a union all select ID,name,RANK from b union all select ID,name,RANK from c) as tb where RANK<(select min(RANK) from (select top 10*(第几页-1) RANK from ( select ID,name,RANK from a union all select ID,name,RANK from b union all select ID,name,RANK from c) as tb order by RANK desc) b) order by RANK desc 排序字段为RANK(有重复),排序规则为desc,请问该如何解决排序字段有重复的问题(注:没有一个字段是唯一的)?