我需要计算出销售价值的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')

最佳答案

你在找这个吗?

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

关于sql - 计算销售值(value)的10%回扣,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50152423/

10-10 14:06