如何拆分或获取列中的值并在同一表中的另一列中更新?PHP MySQL


How to split or get the value in column and update in another column in same table? php mysql

我想问如何获取列的值并更新到具有相同ID的另一列中。这些数据来自电子邮件管道,我想分离正文的值并更新到费用,净额和总额字段中。

我不知道该怎么做..我希望你能帮助我..谢谢

这是我的桌子

+------+---------+--------------------+---------+----------+-------+----------+
| id   | subject | body               | expense |   net    | gross | email    |
+------+---------+--------------------+---------+----------+-------+----------+
|  1   | Sales   | Expense = 2000     |    0    |    0     |   0   | ex@ex.com|
|      |         | netIncome = 5000   |         |          |       |          | 
|      |         | Gross    = 10000   |         |          |       |          |
+------+---------+--------------------+---------+----------+-------+----------+

尝试这样的事情:

UPDATE table_name SET expense = LEFT(body, LOCATE("netIncome",body))