Returning a partial string

jda jda at his.com
Thu Jul 7 15:45:58 CDT 2005


Hi Ruslan,

I have a text field with a list of names, separated by return characters.

I'd like to be able to sort by just the *1st* name, ignoring the 
others. Of course, if there is just one name (which would not end in 
a return) I want to sort by that.

How to put this all in one sql statement?

SELECT * from table ORDER BY Left(textField, (LOCATE(chr(13), textfield)))

looks like it might retrieve the first name, but would get nothing if 
there was no return char.

Any ideas?

Thanks,

Jon


More information about the Valentina-beta mailing list