Q&A for Muslims, experts in Islam, and those interested in learning more about Islam
WITH A As ( SELECT 1 as ID, 100 rank , 'Name1' as Name UNION SELECT 1, 45, 'Name2' UNION SELECT 2, 60, 'Name3' UNION SELECT 2, 42, 'Name4' UNION SELECT 2, 88, 'Name5' ) , B AS ( SELECT 1 as ID, 'fn1' as FileName UNION SELECT 2 , 'fn2') select A.Id, MAX(A.Rank)as ExpertRank from A group by A.Id