2
good afternoon!
I’m not an expert in mysql - so doubt - q might even be silly.
I have a field in a database where a color preference list is stored.
Ex:
Joao prefere: Azul, Verde, Vermelho.
Maria prefere: Verde, Azul, Vermelho
Pedro prefere: Azul, Verde, Vermelho.
in the database have:
Usuario | Cores
Joao | Azul, Verde, Vermelho
Maria | Verde, Azul, Vermelho
Pedro | Azul, Verde, Vermelho
What I need to do:
A Ranking showing which customers' preferred colors.
In this case each color would be scored according to your order.
So in our example:
AZUL: teria 4 pontos (2x 1o lugar + 1 x 2o lugar)
VERDE: teria 5 pontos (2x 2o lugar + 1x 1o lugar)
VERMELHO: teria 9 pontos (3x 3o lugar)
The color with LESS POINTS would be preferred.
Is there any way to do this ranking using only Mysql commands?
I can do this via ASP - would be a job - so the doubt is possible to do this via Mysql, to see and is simpler.
thank you!