View Single Post
  #1  
Old Jul 11, 2012, 05:54 PM
Phonograph's Avatar
Phonograph Phonograph is offline
Senior Member
 
Join Date: Jun 2010
Posts: 4,342
Default about catalogue sorting

if you want catalogues to be sorted in natural order when you click the link to sort them
here's the sql (<catalog> if the keyword from the search)

SELECT catalog, SUBSTRING_INDEX(catalog, '-', -1) AS cn FROM `<database>`
WHERE catalog LIKE '<catalog>%' ORDER BY cn ASC

like that instead of having
KICA-1
KICA-1001
KICA-108

you will have
KICA-1
KICA-108
KICA-1001

Last edited by Phonograph; Jul 11, 2012 at 06:10 PM.
Reply With Quote