From: Dan Nelson Date: May 13 2006 2:02am Subject: Re: how to extract common text string from field? List-Archive: http://lists.mysql.com/mysql/197976 Message-Id: <20060513020250.GA80367@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In the last episode (May 12), Ferindo Middleton said: > Suppose you have a field in a db table that holds email addresses and all of > the address end in domain.com. Is there a MySQL function that can be used to > extract the first part of the email address, the username (the part of the > email address before the 'domain.com' part of the email address). > > I was hoping somehow to do this within a SELECT statement so instead of > seeing the email address I would see the username without the 'domain.com' > part. SUBSTRING_INDEX http://dev.mysql.com/doc/refman/5.0/en/string-functions.html -- Dan Nelson dnelson@stripped