It's not the most elegant solution, but I think this works :
select distinct userid,industryid
from
(
select a.userid , first_value(b.industryid) over ( partition by a.userid order by b.totalclicks desc ) as industryid
from a,b
where a.userid = b.userid
)
HTH
Gert




Reply With Quote