Fixed and simplified the ROW_NUMBER() usage for DB2