Re: select part of a field into another field

2003-07-25 Thread Info
Estoy tomando el sol
.
q

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: select part of a field into another field

2003-07-25 Thread Info
Estoy tomando el sol
.
q

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



select part of a field into another field

2003-07-24 Thread Jason Joines
 I have a table with an email field that contains values of the form 
[EMAIL PROTECTED]  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



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: select part of a field into another field

2003-07-24 Thread Jonathan Patton
Jason, 

For example, if you had a table named test with a column named a, which contained 
one row [EMAIL PROTECTED] 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

 -Original Message-
 From: Jason Joines [mailto:[EMAIL PROTECTED]
 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 
 [EMAIL PROTECTED]  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
 
 
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/[EMAIL PROTECTED]
 
 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: select part of a field into another field

2003-07-24 Thread Dathan Vance Pattishall
Its easier to do it code in my opinion but here is the function you will
need.

SUBSTRING_INDEX('[EMAIL PROTECTED]','@',1) -- joines

---Original Message-
--From: Jason Joines [mailto:[EMAIL PROTECTED]
--Sent: Thursday, July 24, 2003 10:53 AM
--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
--[EMAIL PROTECTED]  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
--
--
--
--

--MySQL General Mailing List
--For list archives: http://lists.mysql.com/mysql
--To unsubscribe:
--http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: select part of a field into another field

2003-07-24 Thread Mysql List
Jason Joines wrote:

 I have a table with an email field that contains values of the form 
[EMAIL PROTECTED]  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?
select SUBSTRING(email, 1, INSTR(email, '@') - 1) frommytable  limit 
1,10;



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: select part of a field into another field

2003-07-24 Thread Victoria Reznichenko
Jason Joines [EMAIL PROTECTED] wrote:
  I have a table with an email field that contains values of the form 
 [EMAIL PROTECTED]  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?

Use SUBSTRING_INDEX() function:
http://www.mysql.com/doc/en/String_functions.html


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: select part of a field into another field

2003-07-24 Thread Jason Joines


-Original Message-
From: Jason Joines [mailto:[EMAIL PROTECTED]
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 
[EMAIL PROTECTED]  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 [EMAIL PROTECTED] 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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]