I have a table like this:
Answer1,Answer2,Answer3,Answer4 A,B,C,CB,D,D,DC,C,A,CB,B,D,D
I want to find most cases for all four answers, if the number of occurrences is the same, I just need the first value. Therefore, ideally, I should have an output table as follows:
Answer1,Answer2,Answer3,Answer4,MostAnswers,Occurrences A,B,C,C,C,2 B,D,D,D,D,3 C,C,A,C,C,3 B,B,D,D,B,2
How to do this on sql server? Can I make a group column by row?