MySQL Natural Sort (like OSX Finder) -


I have searched for it for a long time, but the solutions I have found are not working as I want.

Explain to me: I have a table that includes thousands of products, each with alphanumeric SKU, is also used for sorting.

product number (integer),

class code (number of alphabet characters),

product model variation (optional, variable number of alphabet characters)

For example: mant 12 cl (without spaces) <

  MANT1 MANT2 MANT2C MANT2D MANT2W MANT3: / p>  

Now, I ordered them like this (and if these were the filenames, the OSX finder would get them completely ordered) MANT4C MANT9 MANT12 MANT12C MANT12CL MANT12P MANT13 MANT21 MANT 24 MANT24D MANT29

course sku command is clearly wrong:

  MANT1 MANT12 MANT12C MANT12CL MANT12P MANT13 MANT2 MANT21 MANT24 MANT24D MANT29 MANT2C MANT2D MANT2W MANT3 MANT4C MANT9   

and order of length (SKU), sku problems model variations sorting:

 < code> MANT1 MANT2 MANT3 MANT9 MANT12 MANT13 MANT21 MANT24 MANT29 MANT2C MANT2D MANT2W MANT4C MANT12C MANT12P MANT24D like MA NT12CL   

the finder this material is a way to sort?

(Also, a solution once, there is a way to get to the next and previous product? I have no problem in using a number of questions: elegance at this point is my last issue. ..)

Thank you in advance.


One last thing: my discoveries have found I have but I do not know how to use it to how PHP, so I do not know how it works and really answer my question is.

If so, try to use memory sort for data after loading it already?

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -