Xadren
Xadren

Reputation: 315

Sort queries based on a column's weighted values

I have some data in a database that represents different products.

Each product has a Status O, A or D.

When I display my articles, I always want my data to be sorted O then A then D.

I tried just ordering by my ArticleStatus column, but that does not work. How would I go about sorting my data in the way I have described above.

Thanks.

Upvotes: 0

Views: 27

Answers (1)

ARandomCoder
ARandomCoder

Reputation: 196

ORDER BY FIELD(Status, "O", "A", "D")

Upvotes: 1

Related Questions