Thread: My SQl...query

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    4
    Rep Power
    0
    I have a table called 'sample' with five fields in it. In one of the fields called 'email' I have data with lots of entries which looks like ****@hotmail.com,xxx@hotmail.com.
    I need to replace the "hotmail.com" with "webmail.com" without manually editing the whole table.
    Can i do it with any commands in MySQL.
    or are there any functions to use and change it.
    thanks for the help.

    Suren.

    P.S..I am a beginner in SQL.

  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Denmark
    Posts
    6
    Rep Power
    0
    I would make a script that makes the change... If you have access to Perl,Asp or PHP. I don't know if you can do it only using mysql
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    4
    Rep Power
    0
    I need to try to make it work without using the script and I was wondering if there are any append kinda functions in MySQL.

    I appreciate ur responses!

    Thanks!
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Denmark
    Posts
    6
    Rep Power
    0
    I am pretty sure u can't do it
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Denmark
    Posts
    6
    Rep Power
    0
    you usually use:

    update sample set mail='hans@webmail.com' where mail like '%hotmail.com';

    But in this example you change all e-mail adresses containing hotmail.com in the end to an adress called hans@webmail.com.

    I try figure something out, but it is late now and i will go to bed. Tomorrow i'll find out a solution.

    By the way, I can easily(how do you spell that) make that script for you if you want...
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    4
    Rep Power
    0
    hey thanks gooky!
    I appreciate it.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    29
    Rep Power
    0
    Hi,

    Try this:

    update sample set email = concat(substring(email, 1, instr(email, '@')), 'webmail.com');

    Nothing is impossible in SQL!
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Denmark
    Posts
    6
    Rep Power
    0
    that's nice!

  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    4
    Rep Power
    0
    thanks dude!
    I am amazed....hey u guys just drawn me into this field..gimme some pointers as to where I could find and master this stuff.

    Suren!

Similar Threads

  1. need SQL help - one query or multiples
    By coach in forum MySQL Help
    Replies: 5
    Last Post: February 16th, 2004, 09:39 AM
  2. Replies: 8
    Last Post: January 29th, 2004, 12:45 PM
  3. Replies: 1
    Last Post: December 19th, 2003, 11:12 AM
  4. SQL query brainfade
    By dhanisch in forum MS SQL Development
    Replies: 2
    Last Post: December 16th, 2003, 10:08 AM
  5. passing sql query through querystring
    By buckenmeyer in forum PHP Development
    Replies: 3
    Last Post: December 6th, 2003, 03:09 PM

IMN logo majestic logo threadwatch logo seochat tools logo