问题描述
我有一个声明,
select customer_id,count(customer_id),sum(total_price),date_time
from the_order group by customer_id;
结果,
cus1 15 437700 2021-04-23
cus2 1 12000 2008-5-9
cus3 1 13000 2009-5-9
cus4 1 14000 2006-5-9
现在我也必须使用 customer_id
从数据库中查找其他值。我想将它存储在某个变量中,然后用它来执行其他查询。但我还没有找到如何做到这一点的方法。有什么帮助吗?
解决方法
为什么要将 customer_id 存储在变量中,只需通过客户 id 加入其他表并选择所需的 culomns