[英]merge the sum of 3 columns into another column in php mysql
我想將mysql表中的3列(price_crore,price_lakh,price_thousand)的總和合並到另一個名為“ amount ”的列中。
例如,price_crore,price_lakh,price_thousand的值如下1、75、50。 在金額列上我想要結果17550000
注意:根據印度貨幣系統:price_crore = 10,000,000(1千萬),price_lakh = 100000(10萬),price_thousand = 1000(1000)。
請幫助我在php中實現以上結果。
使用concat函數,類似於:
select concat(sum(price_crore),sum(price_lakh),sum(price_thousand)) ..
from mytable group by ...
我認為您只需要進行數學計算即可:
select price_crore
, price_lakh
, price_thousand
, (price_crore * 10000000)
+ (price_lakh * 100000)
+ (price_thousand * 1000) as amount
from some_table
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.