SQL中分页与distinct冲突解决方案

Posted 以勤补拙

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL中分页与distinct冲突解决方案相关的知识,希望对你有一定的参考价值。

SELECT list.* FROM(SELECT ROW_NUMBER() OVER(ORDER BY salesStatus.LastTime DESC,school.SchoolID DESC) AS rownumber, school.SchoolID,school.SchoolName,school.ProvinceID,school.CityID,school.DistrictID,salesStatus.IsHave,salesStatus.IsLocked,salesStatus.IsShortProtect,
salesStatus.IsAgent,salesStatus.ExpireAllot,sExt.CreatorProtect,school.SchoolLevel,
CHARINDEX(‘3‘,SchoolLevel)  AS IsShengZhongDian,CHARINDEX(‘5‘,school.SchoolLevel) AS IsBaiQiang FROM Area_School AS school LEFT JOIN B_ProductSalesStatus AS salesStatus on salesStatus.SchoolID=school.SchoolID LEFT JOIN B_SchoolOperateAuthExt AS sExt ON school.SchoolID = sExt.SchoolID {0} {1})  AS list WHERE ROWNUMBER BETWEEN  {2} AND {3}

以上是关于SQL中分页与distinct冲突解决方案的主要内容,如果未能解决你的问题,请参考以下文章

mybatis分页与collection的冲突解决

mybatis分页与collection的冲突解决

sql中distinct和order by问题的解决方案

jQuery版本之间冲突如何解决?

SQL中distinct的用法(四种示例分析)

在Fragment中嵌套使用viewpagerindicator切换Fragment返回后出现空白页与FragmentPagerAdapter页面预加载的解决方案