If my DATA sample is
team name score1 score2
Adele's 15 18
Madonna 16 3
Britanny 9 12
How can I get a top 5 list of scores using both columns –
my output should be
Adele's 18
Madonna 16
Adele's 15
Britanny 12
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Derek Kromm’s answer needs a slight modification to avoid a bug when a team has two identical scores in the top 5 (e.g. same as the example, except Madonna score1 and score2 are both 16). The default behavior of union is to remove duplicate rows, so only one of the scores would be kept. Based on the question, I don’t think this is the desired behavior. Addition of the ‘all’ keyword to union will prevent this bug.
I would have posted this as a comment to Derek Kromm’s answer, except that I don’t have enough reputation to do so. Sorry if posting it as an answer is not the correct etiquette.