Re: Last Name extraction in query
| From: | Jim Giner | Date: | Mon, 04 Apr 2011 21:01:25 +0000 |
| Subject: | Re: Last Name extraction in query | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312262@lists.php.net to get a copy of this message | ||
To those who have been so helpful:
I did manage to subscribe to a mysql mailing list. thanks for the pointers.
As for my orig problem - for those who are intereseted:
The FIELD function apparently doesn't work in 5.0.2, even tho it is in the
online ref manual. I was given a suggestion of using INSTR and that worked
beautifully. Here's how it looked in my Select statement:
$q = "SELECT race_winner,count(race_date) as wins,
SUBSTR(race_winner,INSTR(race_winner,' ')+1) as last_name
FROM
trk_races
WHERE race_winner IS NOT NULL
GROUP BY race_winner
ORDER BY wins DESC,last_name";
It works just as I wanted it to.
Thanks to all.