Question regarding qualify clause

General

Question regarding qualify clause

Hi,

I have a following SQL:

select
col1,
col2_tms
from tbl_t1
qualify row_number() over (partition by col1 order by col2_tms desc)=1

I ran this query few times and it is returning me the result set sorted(ascending) on col1 always.

Does the statement "qualify row_number() over (partition by col1 order by col2_tms desc)=1" internally sorts the result on col1?

Please let me know your thoughts on this.

Thanks for your help.
1 REPLY

Re: Question regarding qualify clause

*partition by col1* will sort the col1 in ASC order and then it will sort col2.