0

I want remove 5th character from column using MYSQL Query.

My column lokks like

PRSW000000001
PRSW000000002
PRSW000000003
PRSW000000004
1

You can use string functions like LEFT and RIGHT, and CONCAT the final result.

create table tbl(`Order` varchar(20));
insert into tbl values
('PRSW000000001'),
('PRSW000000002'),
('PRSW000000003'),
('PRSW000000004');
update tbl
set `Order` = concat(left(`Order`, 4), right(`Order`, length(`Order`) - 5));
select * from tbl;
| Order        |
| :----------- |
| PRSW00000001 |
| PRSW00000002 |
| PRSW00000003 |
| PRSW00000004 |

dbfiddle here

  • my table column name is Order just need delete 5th position. i can remove through c# code but i need to remove from MySQL database. column contains 1000 records.. – Harry Mar 2 '18 at 12:08
  • Please do not use reserved words as Order – McNets Mar 2 '18 at 12:11
  • I'm glad to help – McNets Mar 2 '18 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.