Skip to main content

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.

Identify Customers that purchased the same Item multiple times 

2 réponses
  1. 25 mai 2022, 06:39

    And for a little extra performance, you could write this out as:

    {FIXEd Customer ID, SKU:COUNT(SKU)}>1

    You 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

0/9000