![](/img/trans.png)
[英]MySQL update column and return value from another column in the same table
[英]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))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.