Hi,
I hope you are well. Thanks for looking a this post. I'm trying to do a query to calculate the numbers of items within a group. I have tried to solve this problem, but i'm a little stuck, so any help, advice, etc. is much apreciated.
The problem:
A customer puts items in his/her shopping basket. I query the shopping basket to check the shipping group and class for items in his/her basket. This is done by first querying the basket, then querying the products table to obtain the shipping group and class. I can complete this section.
The next step i need to check if products in the basket belong in the same shipping group.
Example:
Product A: group A class 1
Product B: group B class 4
Product C: group A class 3
Product D: group B class 4
Product E: group C class 2
Product F: group D class 2
As you can see there are different groups and classes for each product. Some products have the same group and class (product D & product D). I need to count each product group, but if more than one product has the same group and class, then the group is counted as 1. So using the example above.
Total Products = 6
Total Groups & Classes = 5 (Product B & Product D, counted as one).
If there was another group:
Product G: group C class 2
Total Products = 7
Total Groups & Classes = 5 (Product B & Product D, and Product E & Product G counted as one).
I hope i have explained this well enough and makes sense. Thanks in advance for any help, advice, etc.
Have a nice day,
Ste