sqlserver 多表关联多条件分页排序查询

SELECT TOP
		(#{limit}) 
		storeId,
		intermediaryId,
		storeAddress,
		storeName,
		storePhone,
		principal,
		principalPhone,
		isEnable
		FROM
		(
		SELECT ROW_NUMBER() OVER (ORDER BY
		b.intermediaryId)
		AS RowNumber,
		storeId,
		intermediaryId,
		storeAddress,
		storeName,
		storePhone,
		principal,
		principalPhone,
		isEnable 
		FROM
		(select 
		uis.storeId,
		uis.intermediaryId,
		uis.storeAddress,
		uis.storePhone,
		uis.storeName,
		uis.principal,
		uis.principalPhone,
		uis.isEnable from user_inter_store uis inner join user_intermediary  ui on uis.intermediaryId = ui.intermediaryId  where uis.isEnable=1
		
		
        and ui.name = #{name}
        
          
          and uis.principal =#{principal}
        
        
        and uis.storeAddress  =#{storeAddress}
        
        
        and uis.storeName  =#{storeName}
        
        
        and uis.principalPhone like =#{principalPhone}
        
        
          order by uis.storeId desc 
        
        
		)
     as b
		) as a
		WHERE (a.RowNumber >
		#{pages}) 
				

你可能感兴趣的:(sqlserver 多表关联多条件分页排序查询)