MySQL Forums
Forum List  »  Newbie

Re: Challenge while using row_number()
Posted by: Mikael Eriksson
Date: January 08, 2022 02:43PM

I don't think this question was overly complicated, unless one wants to complicate it. At another forum my question was understood fully as such, and the following solution (which works nicely) was provided.

WITH cte AS ( SELECT f6... )
SELECT ROW_NUMBER()
OVER (ORDER BY cp DESC, f1 DESC, f2 DESC
, f3 DESC, f4 DESC, f5 DESC) AS pos
, cte.*
FROM cte

But I'm still wondering why order by-part doesn't see my renamed column name.

--m

Options: ReplyQuote


Subject
Written By
Posted
Re: Challenge while using row_number()
January 08, 2022 02:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.