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 > ? on SQL Scripting

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-20-04, 17:24
Strikerz95 Strikerz95 is offline
Registered User
 
Join Date: May 2004
Posts: 28
? on SQL Scripting

I need to generate emails address for about 800 students in a MySQL database. Is there a way to write a script that will take the values in the firstname, middlename, and lastname columns and generate email address in a new column based on a format like this: email address= <firstinitial><middleinitial><lastname>@<ourdomain >? Then i would like to be able to export that column and import it into Groupwise.

Thanks for the help,
Brian
Reply With Quote
  #2 (permalink)  
Old 05-20-04, 19:05
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
Code:
select concat_ws('',firstname,lastname,'@','ourdomain') as email from table
the first two items are single quotes after the bracket. ourdomain only needs to be in quotes if you are appending an actual string. if you are pulling it from the database you won't need the quotes.
Reply With Quote
  #3 (permalink)  
Old 06-03-04, 19:06
Strikerz95 Strikerz95 is offline
Registered User
 
Join Date: May 2004
Posts: 28
thanks for the help, im getting closer
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