Hi @MichelDiz,
While computing total_items_by_Customer, Your query will count the total number of items ordered by each customer right. As @AugustHell said, i want to “count the number of distinct items bought by each customer”. In the example specified by me, the items ordered by the customer A are X, Y, Y, Z . So, the distinct items ordered by him are 3 (X,Y,Z).