Solved

Erase some values in a field, leave the rest alone

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL 11 79
PHP connection to remote AWS MySQL RDS 4 64
simple mysql statement 3 31
Amazon Redshift 2 24
All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 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

12 Experts available now in Live!

Get 1:1 Help Now