Solved

Erase some values in a field, leave the rest alone

Posted on 2013-01-04
2
225 Views
Last Modified: 2013-01-08
I have a table with a field called 'Website'

Some of the info is entered like this:  google.com

Some of it like this:  www.google.com

and Some like this: http://www..google.com

How can I parse all the fields so that all the records will all show the domain.com only, erasing  the rest?

Thanks
0
Comment
Question by:Rush_2112
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 38745837
Try:
UPDATE `tblWebsite` SET `Website`= SUBSTRING(`Website`,8) WHERE SUBSTRING(`Website`,1,7)='http://'

Open in new window

followed by
UPDATE `tblWebsite` SET `Website`= SUBSTRING(`Website`,5) WHERE SUBSTRING(`Website`,1,4)='www.'

Open in new window

Note that not all websites are configured to work without www.
0
 
LVL 1

Author Closing Comment

by:Rush_2112
ID: 38756046
Worked perfectly, thank you!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Creating and Managing Databases with phpMyAdmin in cPanel.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now