I found this nifty little order by condition that sorts strings of the type "First Last" nicely, even handling "First Van Damn" properly.
"SUBSTRING(p.name, LOCATE(' ', p.name) +1)
Now, I have some names in there like "Alfred E. Newman" and want the sorting to work properly for that name (ie it does not end up under E).
Any help would be greatly appreciated.
If you really want to do it, how about
RIGHT(p.name, LOCATE(' ', REVERSE(p.name)) - 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With