SQL轮询

SQL Round query

尝试将我在 SQL 中的查询的销售税和小计四舍五入到小数点后两位。 这是我的查询。

    select OrderID
    , ItemID
    , '$' + cast(price as varchar (7)) as [Price] 
    , (price) * 0.06 as [Sales Tax] 
    , (price) * 0.06 + (price) as [Subtotal]

    from ORDER_ITEM
    where price >= (20)

谢谢

select OrderID
    , ItemID
    , '$' + cast(price as varchar (7)) as [Price] 
    ,convert(decimal(18,2), (price) * 0.06) as [Sales Tax] 
    , convert(decimal(18,2),(price) * 0.06 + (price)) as [Subtotal]

    from ORDER_ITEM
    where price >= (20)
   -- You Can Use ROUND Function to Round Up The Column you want.   
       select OrderID
            , ItemID
            , '$' + cast(price as varchar (7)) as [Price] 
            , ROUND((price) * 0.06,2) as [Sales Tax] 
            , ROUND((price) * 0.06 + (price),2) as [Subtotal]

            from ORDER_ITEM
            where price >= (20)