最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[未解决]mysql中基于已有列的值赋值新列的值

MySQL crifan 2212浏览 0评论

此处要把:

MariaDB [guanzhi_removeDuplicate]> SHOW COLUMNS from selection;
+—————–+————-+——+—–+———+—————-+
| Field           | Type        | Null | Key | Default | Extra          |
+—————–+————-+——+—–+———+—————-+
| id              | int(10)     | NO   | PRI | NULL    | auto_increment |
| staff_id        | int(10)     | NO   | MUL | NULL    |                |
| car_sn          | varchar(10) | NO   |     | NULL    |                |
| bid_price       | int(10)     | NO   |     | NULL    |                |
| created_at      | int(10)     | NO   |     | NULL    |                |
| created_at_gmt8 | int(10)     | NO   |     | NULL    |                |
| sequence        | int(10)     | NO   |     | NULL    |                |
+—————–+————-+——+—–+———+—————-+
7 rows in set (0.00 sec)

中的:

created_at

的值,经过变换:

从GMT标准时间转换为GMT+8的时间,然后赋值给:

created_at_gmt8

mysql set column based on some column

sql – mysql update column with value from another table – Stack Overflow

Mysql – How to update a column using another column’s value plus some strings – Stack Overflow

MySQL – UPDATE query based on SELECT Query – Stack Overflow

mysql – update column based on the sort order of another query – Database Administrators Stack Exchange

mysql – How to update one table based on another table’s values on the fly? – Database Administrators Stack Exchange

主要就是用UPDATE命令

然后想办法去:

[未解决]如何从GMT的时间戳整数的到GMT+8的时间戳

转载请注明:在路上 » [未解决]mysql中基于已有列的值赋值新列的值

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.176 seconds, using 22.18MB memory