如何在MYSQL中存储查询结果的整列值?

问题描述

我有一个声明,

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...