How to store entire column values of the query result in MYSQL?

768 views Asked by At

I have a statement,

select customer_id,count(customer_id), sum(total_price), date_time 
from the_order group by customer_id;

The Result,

cus1    15  437700  2021-04-23
cus2    1   12000   2008-5-9
cus3    1   13000   2009-5-9
cus4    1   14000   2006-5-9

Now as I have to use the customer_id to find other values from the database too. I want to store it in some variable and then use it to do other queries. But I have not found a way how to do that. Any help?

1

There are 1 answers

2
Waheed On BEST ANSWER

Why you are storing customer_id in variable simply join other tables through customer id and select your desired columns.