-2
Hey, all right, guys?
Well, I need to identify weekly clients who have an active plan but didn’t use the plan that week.
I have two tables, one that contains the type of client’s plan and another that includes the customers who used the service.
How do I give a Join between these two tables so that it brings me per week customers who had an active plan but did not use the service in a given week?
PS: Clients have unique Id and both tables have this id.
In the table of customers who used service, the date is already in date_trunc week.
In the table of purchased plans , the date of purchase and closure are also already in date_trunc week.
And I’ve also created an auxiliary table with every week of 2020 to group these two tables.
You evaluated the possibility of making a junction between your auxiliary table and the plan table for the weeks in which the plan was active and then using a
NOT EXISTS
for a subselect in the table of customers who used the service by correlating client and week?– anonimo