Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ordering AA before A

I'm doing an e-commerce website for a client who sells lingerie, I've written up a bra size picker for them but they've come back to me today with a slight issue.

With bra sizes, AA is smaller than A, so it should appear before that in the chart, but when I use MySQL order by on the size, obviously it puts A first, then AA, then B etc.

Is there a simple way I can get MySQL to order AA first, then A, B etc.?

like image 307
Andy Avatar asked Jul 14 '11 11:07

Andy


1 Answers

I would add another column "orderid" (INTEGER or even TINYINT) to your table, and order by that column instead.

like image 74
Matt Healy Avatar answered Oct 05 '22 10:10

Matt Healy