【发布时间】:2018-02-17 18:18:12
【问题描述】:
当特定用户支付现金时,插入下表
payments:
description | Amount | Date | custid
cash | 2000 | 2014-9-24 | 5
cash | 3000 | 2014-9-26 | 5
特定用户购买产品时,插入下表
orders
Product | qty | amount | date | custid
front light | 2 | 3000 | 2014-9-22 | 5
back light | 2 | 2500 | 2014-9-22 | 5
- 如果上述表格需要更改,也请指导我。?
- 是否需要支付表中的余额列。 ?
- 请记住,我是程序员而不是会计师,如果借记卡有任何错误,请告诉我。
我需要这个结果或类似的东西(客户的销售分类帐/客户帐户详细信息)。 SQL 查询是什么?
Product | Debit | Credit | Balance
opening bal | | | 0
product | 5500 | | 5500
cash | | 2000 | 3500
cash | | 3000 | 500
【问题讨论】:
-
所以您对在结果中包含日期不感兴趣?
-
yes date's must be included and , 也用于 where 条件。我没有写在上表中以消除复杂性。
-
我认为我们可以处理这种复杂程度。清晰度也很重要。