I have a sales table with price
column as decimal(8, 2)
and I'm running the query below to get the total price
select sum(case when status = 1 then price * quantity when status = 2 then price * quantity * -1 else 0 end) as total from sales;
It's working perfectly but my results are usually intergers so I end up with trailing zeros all the time. It'd be nice to just return the whole number if there is no decimal part
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.