Solved

mysql delete some alphabet from record

Posted on 2010-11-24
5
424 Views
Last Modified: 2012-05-10
How can i delete some title from colum b

Mr.David   change to  David
MissSusan  Change to  Susan
0
Comment
Question by:teera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Author Comment

by:teera
ID: 34210719
hi expert
  Miss or Mr   or Mrs must be in the first  if somepeople name  samrart  it should not elete mr from his name
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34210721
update table TableName set b = 'David' where b = 'Mr.David';
update table TableName set b = 'Susan' where b = 'MissSusan';
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 34210730
I presume you want this:

UPDATE yourtable SET b = SUBSTRING(b, 4, 1000)
  WHERE b LIKE 'Mr.%';
UPDATE yourtable SET b = SUBSTRING(b, 4, 1000)
  WHERE b LIKE 'Mr %';
UPDATE yourtable SET b = SUBSTRING(b, 5, 1000)
  WHERE b LIKE 'Miss%';

Open in new window

0
 

Author Comment

by:teera
ID: 34210734
Hi jimyX

  some people they nor name David
0
 
LVL 7

Assisted Solution

by:mkobrin
mkobrin earned 250 total points
ID: 34210769
UPDATE yourtable SET b = SUBSTRING(b, 4,)
  WHERE b LIKE 'Mr.%';
UPDATE yourtable SET b = SUBSTRING(b, 4)
  WHERE b LIKE 'Mr %';
UPDATE yourtable SET b = SUBSTRING(b, 5)
  WHERE b LIKE 'Miss%';
UPDATE yourtable SET b = SUBSTRING(b, 4)
  WHERE b LIKE 'Mrs%';
UPDATE yourtable SET b = SUBSTRING(b, 5)
  WHERE b LIKE 'Mrs.%';
UPDATE yourtable SET b = SUBSTRING(b, 6)
  WHERE b LIKE 'Miss.%';





0

Featured Post

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

719 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