简体   繁体   中英

MySql PHP Add Values from fields

Scenario:

I have a MySql Database called "tblreqslipdetails" it has a field "subtotals" which has a value = Integer (ex. 4500.50, 2500, 3500.57.. so on..) it also has a field which has "idcategory" which has a value of (2, or 4 or 5).

Question:

How can I create a query base on my "idcategory" and add the value in my field "subtotals"?

Like:

From Where ID="idcategory" add array??? "not sure really" "subtotal" = Total

To cut it short, I would like to create a simple script where I can add the subtotals from my fields..

Thanks in advance.

就像Vijay所说的,我认为您正在寻找更新。

UPDATE `tblreqslipdetails` SET `subtotals`=`subtotals`+2000 WHERE `idcategory`=2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM