gpt4 book ai didi

MySQL 查询 : Get new customers in the month

转载 作者:可可西里 更新时间:2023-11-01 07:56:26 26 4
gpt4 key购买 nike

我在一个包含以下列的表中有数百万条记录:

id, item_id, customer_id, date

我想查找特定月份的 customer_id,这是该月份第一次插入表中。

什么是最好的和简单的查询。

谢谢

最佳答案

select customer_id , min(date) as min_date
from theTable
group by customer_id
having min_date>=<the desired date>

关于MySQL 查询 : Get new customers in the month,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22141377/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com