Hello everyone,
I am trying to create a report regarding return customers and their behaviors.
Part of this is that I want to see who of the customers that bought something multiple times, also purchased the same Item (SKU) twice.
The problem is that I can not simply take the First Order and SKU and compare that to the Last Order since some customers bought more than twice.
Attached is a screenshot with the customer id, orders, SKU and order date.
I hope anyone has some idea regarding this.
Kind regards.
And for a little extra performance, you could write this out as:
{FIXEd Customer ID, SKU:COUNT(SKU)}>1You are using integers here, so by dropping to greater than 1, you'd still catch the same items, only the RDBMS need check for a greater than rather than needing to check for both greater than or equal to. Its a small performance gain, but is also a freebie right as you don't need to do anything else.
Steve