samedi 25 juin 2016

MySQL - sort result by specific record

Perhaps someone could tell me, how to order MySQL output in this specific scenario: I have table like this: | id | Value1 | Value2 | ...More values that doesn`t matter in this example ^-----^--------^--------^ | 1 | 1 | X | | 2 | 2 | X | | 3 | 3 | 2 | | 4 | 1 | X | | 5 | 2 | X | | 6 | 3 | 3 | | 7 | 1 | X | | 8 | 2 | X | | 9 | 3 | 1 | I want to get values from this table, and I want to order them by Value2, but only there, where Value1 is 3 (X values doesn't matter). What`s the best way to do this, with good performance? Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire