Hello!

I have this query:

with cte as

(select t.ktokk, t.txt30,

case

when t.spras='P'then '1'

when t.spras='E' then '2'

else '3'

end as ord_ktokk

from t077y t

order by ord_ktokk )

select *, rank() over(partition by t.ktokk order by ord_ktokk ASC) as osis

FROM cte ---- this part is giving an error.

I wanted to make a table that give me the distinct values of 't.ktokk' order by 'ord_ktokk'

Thanks for the help!