Add: Problem with ORDER BY

2002-08-30 Thread Jürgen Müller
I've changed my query to: $order = "SUBSTRING_INDEX(objektname,'-',1)"; $order .= ",RIGHT(objektname,(LENGTH(objektname)-LOCATE('-',objektname)))"; so that the syntax ist okay, and the tests too: mySQL returns the correct values: objekt SUBSTRING_INDEX(objekt,'-',1) LENGTH(objekt) LOCATE('-'

Add: Problem with ORDER BY

2002-08-30 Thread Jürgen Müller
I've changed my query to: $order = "SUBSTRING_INDEX(objektname,'-',1)"; $order .= ",RIGHT(objektname,(LENGTH(objektname)-LOCATE('-',objektname)))"; so that the syntax ist okay, and the tests too: mySQL returns the correct values: objekt SUBSTRING_INDEX(objekt,'-',1) LENGTH(objekt) LOCATE('-'

Problem with ORDER BY

2002-08-30 Thread Jürgen Müller
Hello, I have a colum as varchar with entries like MD1-1, SD1-10, MD1-4354, KD2-998, ... Now I have a problem with sorting them, because they are treated as a string (f.e. MD1-1 is bigger than KD-998). My order query: $order = "SUBSTRING_INDEX(b.objektname, '-', 1)"; // getting everithing left