rank 和 ROW_NUMBER 区别
SELECT * , RANK() OVER ( PARTITION BY APP_NAME ORDER BY SETTING_NAME,SETTING_CODE ASC ) AS Rank FROM ( SELECT WSAPPSETTING.ID , WSAPPSETTING.APP_ID , WSAPPREGISTER.APP_NAME , WSAPPSETTING.SETTING_NAME , WSAPPSETTING.SETTING_CODE , WSAPPSETTING.SETTING_VALUE , WSAPPSETTING.REMARK FROM WS_APP_SETTING WSAPPSETTING INNER JOIN WS_APP_REGISTER WSAPPREGISTER ON WSAPPREGISTER.ID = WSAPPSETTING.APP_ID WHERE 1 = 1 ) tt; SELECT * , ROW_NUMBER() OVER ( PARTITION BY APP_NAME ORDER BY SETTING_NAME,SETTING_CODE ASC ) AS ROW_NUMBER FROM ( SELECT WSAPPSETTING.ID , WSAPPSETTING.APP_ID , WSAPPREGISTER.APP_NAME , WSAPPSETTING.SETTING_NAME , WSAPPSETTING.SETTING_CODE , WSAPPSETTING.SETTING_VALUE , WSAPPSETTING.REMARK FROM WS_APP_SETTING WSAPPSETTING INNER JOIN WS_APP_REGISTER WSAPPREGISTER ON WSAPPREGISTER.ID = WSAPPSETTING.APP_ID WHERE 1 = 1 ) tt;
rank原来是会跳号的。