Calculating Weighted Votes and Identifying the Winner
Create a Common Table Expression (CTE) to calculate the weight of each vote by dividing 1 by the count of candidates (including nulls) each voter voted for.
Create another CTE to sum the vote weights for each candidate to get their total votes.
Use the RANK() window function to rank candidates based on their total votes in descending order.
Filter out the candidates with the highest rank (rank = 1).
Order the resulting candidates in ascending order to get the final list of winners.