如何根据日期范围从表中获取数据?
是否有可能有一个SQL查询,该查询可以每日日期和客户提取数据? 用例: 表1有客户购买的商品,并提供购买数据 表2具有客户可能取得的所有支持门票。
我希望向购买的客户(在表1中)过滤表2数据,但在购买前10天或之后也与我们联系。
因此,如果鲍勃在6/1/2022购买螺丝刀(在表1上)。我希望在5/21/22到6/10/22之间从Bob中拨打任何电话,
Is it possible to have a sql query which pulls data per date and customer?
Use case:
Table 1 has items purchased by customers, with data of purchase
Table 2 has all of the support tickets customers may have reached out for.
I am looking to filter table 2 data to customers who have purchased (in table 1) but also have contacted us either 10 days before or after the purchase.
So if Bob purchases a screw driver on 6/1/2022 (on table 1). i am looking to pull any calls from Bob between 5/21/22 to 6/10/22
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用日期范围的未经测试的代码:
'[]'
包含在depaterange
中,以使上限包含在内。换句话说,它会碰到上部date
向上一个。更新
从此处 date/time functions/operators 在雅典娜/普雷斯托中,这似乎是可能的:
Untested code using date range:
The
'[]'
is included in thedaterange
to make the upper bound inclusive. In other words it will bump the upperdate
up one.UPDATE
From here Date/time functions/operators this would seem to be possible in Athena/Presto: