-2

I want to get data from 2 columns, from '1h' and 'rate', and combine these values with '|' and add it to another column named '24h'. Something like "1h|rate"

update `exchanges` set 24h = `1h`.'|'.`rate` where id=1
juergen d
  • 201,996
  • 37
  • 293
  • 362
burkul
  • 113
  • 1
  • 5
  • 1
    not sure why you are doing this instead of doing this i advice you to use [generated columns](https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html) instead or use a VIEW or normal SELECT to generate a concat when you need it which make more sense.. – Raymond Nijland Aug 26 '19 at 13:12
  • this is only needed one time, so no big deal. will not use this continuously – burkul Aug 26 '19 at 13:37

1 Answers1

-1
update `exchanges` 
set `24h` = concat(`1h`, '|', `rate`) 
where id = 1

But note that this seems to be a denormalized column if you put multiple values in it.

juergen d
  • 201,996
  • 37
  • 293
  • 362