【问题标题】:Saparate Sql Table column with slash and store value in new column用斜线分隔 Sql Table 列并将值存储在新列中
【发布时间】:2022-01-20 09:09:34
【问题描述】:

我有一个 Table,其中 column1 的值为 A/B,采用数字格式。我想分隔值 B ( / 分隔值)并使用 SQL Query 将它们存储在 column2

当前列

Column1
---------
1.201/1.207
2.512/2.651

我要求

Column1 |  Column2 
-------------------
1.201   |   1.207
2.512   |   2.651

【问题讨论】:

  • SUBSTRING_INDEX()

标签: mysql sql phpmyadmin


【解决方案1】:

UPDATE Table SET column2 = 和类似 SUBSTRING_INDEX('A/B', '/', -1)

https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring-index上查看更多信息

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多