计算销售额的10%回扣

时间:2018-05-03 10:11:30

标签: sql postgresql

我需要为销售价值计算10%的折扣价值,不知道如何做到这一点。我是SQL的新手,感谢您的帮助。

select customer_code, invoice_date, sales_order_number, product_code, 
    qty_inv, sales_value, b.mpn
from sales_summary as a
    INNER JOIN stock_summary as b ON a.product_code = b.part
where invoice_date > date_trunc('month', CURRENT_DATE) - INTERVAL '3 months'
    and customer_code in ('SSMIDC3','SSMIDC2','SBERDC2','STWYB','SSMIDCE')

1 个答案:

答案 0 :(得分:0)

你在找这个吗?

select customer_code, invoice_date, sales_order_number, product_code,
       qty_inv, sales_value, b.mpn,
       (0.1 * sales_value) as rebate_value
. . .