Reputation: 2480
I have table like
+-----------+------------+------+------+------+
| id | name | col1 |col2 | col3 |
+-----------+------------+------+------+------+
I want order my table with two column like (col1, col2) in (v1,v1),(v2,v2)...
and some other order.
In MySQL
has ORDER BY FIELD(col1, 'v1', 'v2', 'v3') DESC, other columns ASC;
but how using it in multi column like my example thanks.
Upvotes: 0
Views: 21
Reputation: 780724
You can concatenate the strings.
ORDER BY FIELD(CONCAT(col1, ',', col2), 'v1,v1', 'v2,v2', ...)
Upvotes: 1