SQLite Calculation with same Values different Results

前端 未结 1 874
醉梦人生
醉梦人生 2021-01-28 17:19

My table contains this values

productName | purchasePrice | tax | price 
------------+---------------+-----+--------
Product 1   | 5099          | 16  | 10099
Pr         


        
相关标签:
1条回答
  • 2021-01-28 18:12

    In the latest version of SQL-lite the below code works with Round

    select SUM(Profit) from (
    select productName,round((SUM(price- (price*TAX/100.0 + purchasePrice)))/100 ,2)
    as Profit
    from test
    GROUP BY productName
    )x
    

    http://sqlfiddle.com/#!5/8eba1/25

    0 讨论(0)
提交回复
热议问题