jeudi 2 juin 2016

Mysql query based on columns matches

I don’t know how to make this with mysql, I only know how to do basic queries, I want to show a list of result based on matches, Results will be shown based on the same value of the answers…answers may have a value from 1-10

+++++++++++++++TABLE++++++++++++

id  | userName | answer1 | answer2 | answer3 | answer4….

10    Jhon       1        1         3          8

11    Anne       1        2         4          8

12    Mike       7        4         5          7

etc…
++++++++++++++++++++++++++++++++++++++++

If I send the values in the query I want that check the answers and show the result sorted my matches, more matches first…no matches last

So if i send the results:

answer1=1  answer2=1 answer3=7 answer4=2...

the result should be(give back the id)

10 11 12

Aucun commentaire:

Enregistrer un commentaire