Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to integrate new data with existing data in a column in mysql?

i want to integrate data with exiting data in a column in phpmyadmin.

for example i have a table which has a column (ticket_number).

And its exiting value is 234 and want to add '1' before 234 so that the value will be 1234. this below written code not working for this.

UPDATE ticket
SET `ticket_number`+= '1';

thanks in advance.

like image 457
Manish Goyal Avatar asked Feb 01 '26 08:02

Manish Goyal


1 Answers

Try using CONCAT:

UPDATE ticket
SET ticket_number = CONCAT(1,ticket_number)

Because if you add up the "1" directly you'll get 235 not 1234...

like image 101
DarkAjax Avatar answered Feb 03 '26 23:02

DarkAjax



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!