I want to merge the sum of 3 columns (price_crore,price_lakh,price_thousand) in mysql table into another column called ' amount '.
For example price_crore,price_lakh,price_thousand for which values are as follows 1,75,50. on the amount column I want the result 17550000
note: according to indian currency system: price_crore= 10,000,000 (1 crore) and price_lakh=100000 (1 lakh) and price_thousand=1000(1 thousand).
please help me achive the above result in php .
use concat function , something like :
select concat(sum(price_crore),sum(price_lakh),sum(price_thousand)) ..
from mytable group by ...
I think you just need to do the math:
select price_crore
, price_lakh
, price_thousand
, (price_crore * 10000000)
+ (price_lakh * 100000)
+ (price_thousand * 1000) as amount
from some_table
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.