Jump to content

Correct order for Sizes in mysql (Feet & Inches)


janglijagga

Recommended Posts

I have a small question.

 

I have a mysql table where I store Width & Length of my items in four fields: Feet1, Inch1, Feet2, Inch2. Now I have to pull out records in ascending order in the priority-order of Feet1, Inch1, Feet2, Inch2.

 

Something like this example:

 

(Width x Length)

1'    x 2'

1'    x 2' 6"

1'    x 3'

1' 6" x 2'

1' 6" x 2' 6"

2      x 1'

2'    x 1' 6"

2' 6" x 1'

 

My query is something like this:

mysql_query("SELECT * FROM tblname ORDER BY Feet1+0, Inch1+0, Feet2+0, Inch2+0");

 

Sorry, I'm not too well versed in mysql. Please help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.