If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > update and function in same table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-30-07, 22:13
hconnor hconnor is offline
Registered User
 
Join Date: Feb 2007
Posts: 34
update and function in same table

hi,

this is probably straightforward question: i want to update my table by performing a function on name_ID field and saving it as ID_encryp field, namely by encrypting it; but i'm also interested in the bigger question of how to do a function on a field and save it in another field in mysql.

the next question is where to start to get the SQL code to go through the table and perform the function on each row, saving the result in the ID_encrypt field.

sorry, i know this is probably pretty basic.

all help appreciated.

mike
Reply With Quote
  #2 (permalink)  
Old 03-30-07, 23:30
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Code:
update daTable
   set ID_encryp = somefunction(name_ID)
will update all rows
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-31-07, 09:22
hconnor hconnor is offline
Registered User
 
Join Date: Feb 2007
Posts: 34
thanks r937. it was just what i needed . . .
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On