Hi
I can't seem to get the search to give me what I want.
My SELECT statement in MySQL db looks like this
$svar = mysql_query("SELECT Andel,
substring_index(Namn,' ',1) AS surname,
substring_index(Namn,' ',-1) AS firstname
FROM Uppgifter
WHERE Andel>=24 AND Andel <=48
GROUP BY Andel, surname
ORDER BY Andel ") or die ("unable to perform query");
I want only the first initial of the firstname. What I can't figure out is how to use the delimiter (blank space) together with the lengt statement which is found in the SUBSTRING(str,lenght) statement.
I also tried this
...
substring_index(Namn,' ',-1) AS firstname
LEFT('firstname',1)
...
but that didn't work.
Any ideas??