MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Jason Joines Date:July 24 2003 8:30pm
Subject:Re: select part of a field into another field
View as plain text  
>
>
>>-----Original Message-----
>>From: Jason Joines [mailto:joines@stripped]
>>Sent: Thursday, July 24, 2003 1:53 PM
>>To: MySQL Users
>>Subject: select part of a field into another field
>>
>>
>>  I have a table with an email field that contains values of the form 
>>uid@domain.  I need to populate a new field called uid with 
>>just the uid 
>>part of the email address.  Is there any way of using select to just 
>>retrieve the part before the @ and insert it into the uid field?
>>
>>Thanks,
>>
>>Jason Joines
>>Open Source = Open Mind
>>========================
>>
>>    
>>


Jonathan Patton wrote:

>Jason, 
>
>For example, if you had a table named "test" with a column named "a", which contained
> one row "test@stripped" you would do a query like:
>
>
>mysql> select substring(a,1,instr(a,'@')-1) from test;
>+-------------------------------+
>| substring(a,1,instr(a,'@')-1) |
>+-------------------------------+
>| test                          |
>+-------------------------------+
>1 row in set (0.00 sec)
>
>
>There are probably other ways to do this as well. 
>
>Jonathan
>

    Thanks, that was exactly what I needed!  Until all the responses to 
my message it never occured to me to search the manual for string fucntions.

Jason
============

Thread
select part of a field into another fieldJason Joines24 Jul
  • RE: select part of a field into another fieldDathan Vance Pattishall24 Jul
    • Function to extract difference in Minutes from DateTime variablesC.F. Scheidecker Antunes24 Jul
      • RE: Function to extract difference in Minutes from DateTime variablesDathan Vance Pattishall24 Jul
  • Re: select part of a field into another fieldMysql List24 Jul
  • Re: select part of a field into another fieldVictoria Reznichenko24 Jul
RE: select part of a field into another fieldJonathan Patton24 Jul
  • Re: select part of a field into another fieldJason Joines24 Jul
Re: Function to extract difference in Minutes from DateTime variablesInfo26 Jul
RE: Function to extract difference in Minutes from DateTime variablesInfo26 Jul
Re: select part of a field into another fieldInfo26 Jul
Re: select part of a field into another fieldInfo26 Jul