【发布时间】:2020-06-11 01:53:35
【问题描述】:
我有一个带有列的表格:
customer_id,
customer_name,
transaction_number,
transaction_date,
transaction_type,
transaction_value,
transaction_approved.
我正在尝试生成列所在的列表
customer_id,
customer_name,
total transaction value
transaction_type 为贷方且于 2020 年完成,transaction_type 为 2019 年借方或现金的总交易额。
但是,此列表仅包括 customer_id 在 2020 年使用信用进行了至少一笔交易。基本上,我将如何使用 where 子句获取 customer_id 的条件,然后获取其余的仅基于customer_ids 的列表?
它会返回
-
customer_id至少有一笔交易是在 2019 年使用信用进行的 - 然后它旁边的其他列将返回该
customer_id的值
【问题讨论】:
-
我不清楚。请添加示例输入和输出数据。
-
另外请向我们展示您目前编写的代码
-
您是否有一个列出现有
customer_ids的表格?
标签: sql where-clause case-when