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('-'
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('-'
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