What is the equivalent of row_number() over partition in hql I have the following query in hql:
select s.Companyname, p.P
Row number by partition looks like this:
row_number() over (partition by s.Companyname)
You can not use window function row_number
in where
clause, so you have to do subquery with filter by its value:
select * from (
-- here is your query
select
...,
row_number() over (partition by s.Companyname) as rowNum
from ...
where ...
) as res
where rowNum <= n