convert it into inches and then sort on that.
in php
$parts=explode(',', $length);
$inches = ($parts[0] * 12) + $parts[1];
for each element and then do an [man]array_multisort()[/man] on the resulting array but that's a messy way of doing it. Let's see if we can do it in the query
SELECT * FROM table ORDER BY (SUBSTRING_INDEX(length, ',', 1) * 12) + SUBSTRING_INDEX(length, ',', -1)
I've got a funny feeling that won't work, if it doesn't try
SELECT *, (SUBSTRING_INDEX(length, ',', 1) * 12) + SUBSTRING_INDEX(length, ',', -1) AS inch_length FROM table ORDER BY inch_length
Let us know if it works 🙂
Bubble