Unix Technical Forum

Multiple Trims

This is a discussion on Multiple Trims within the MySQL forums, part of the Database Server Software category; --> Given a database with names like "Joe Bob" and "Fred Allen Jr.", the following correctly sorts them: ORDER BY ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 02:49 PM
Shannon Appelcline
 
Posts: n/a
Default Multiple Trims

Given a database with names like "Joe Bob" and "Fred Allen Jr.", the
following correctly sorts them:

ORDER BY SUBSTRING_INDEX(TRIM(TRAILING ' Jr.' FROM $table.$key),'
',-1)

However, I can't come up with a proper way to trim multiple possible
suffixes (e.g., Jr., Sr., II, or III). I can't seem to use |s and
nesting the trims didn't seem to work either.

Ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:47 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com