sql - Can I order by rank or dense rank in ntile function? -
i looking in regards finding out whether can use rank/dense rank function within ntile query.
i have following code have written:
ntile(5) on (partition job_type order score desc) m_ntile ,dense_rank() on (partition month_ending, job_type order m_ntile desc) rank
but want instead of order score in ntile ordered results in rank query.
is possible? if please advise appreciate it.
you need use subquery:
select t.*, dense_rank() on (partition month_ending, job_type order m_ntile desc) rank (select . . ., ntile(5) on (partition job_type order score desc) m_ntile . . . ) t
however, doesn't seem necessary. why not use score
?
select t.*, dense_rank() on (partition month_ending, job_type order score desc) rank
Comments
Post a Comment