Solved

Erase some values in a field, leave the rest alone

Posted on 2013-01-04
2
227 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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