Reputation: 129
This is my database structure. I want to update mobileno column where length(mobileno)!= 13
, and add 88 string before them . Like 017126875493 becomes 88017126875493
Upvotes: 0
Views: 10
Reputation: 37473
You can try using concat()
UPDATE tablename SET mobileno = concat('88',mobileno)
WHERE length(mobileno) != 13;
Upvotes: 1
Reputation: 129
Solved it by using concat()
UPDATE passenger.mobileno
SET passenger.mobileno= CASE
WHEN length(passenger.mobileno)=11 THEN CONCAT("88",passenger.mobileno)
ELSE passenger.mobileno
Upvotes: 0