user1694770
user1694770

Reputation: 13

MYSQL Set 1 field to equal another field - but add text

I'm wondering if there's a way to use update your_table set B = A

But I'd like to add some numbers at the front

So it's more like update your_table set B = ('00',A)

Upvotes: 1

Views: 137

Answers (2)

JSK NS
JSK NS

Reputation: 3446

This represents bad relational data storage practice. Rather than duplicating data which may result in headaches later (you now need to update two columns to change one set of data) you should concatenate the results upon retrieval.

Upvotes: 0

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171509

update your_table 
set B = concat('00', A)

Upvotes: 1

Related Questions