I have a MySQL table that has price requests in it, it has date, first, last, and product_id fields. The product brand can be found from the product table from the product_id.
Given a date range, they want to know the total number of requests, by people and by brand for each day in the date range, and total for date range. Here is the tricky part, if the same person makes a request more than once in a day, then it only counts as 1 for people. But if a person makes a request for 2 different brands in 1 day, each brand gets 1 for that day. but if they make a requests for mulitples of a brand in a single day that brand only gets counted 1 for that day.
For example lets say on a given date John Doe made 3 price requests, for a Burberry product and 2 swarovski products. That would only count 1 for people, 1 for burberry, and 1 for swarovski. But if another person made a request for burberry then there would be 2 burberry for that day and 2 people for that day.
I hope this makes since. Anyways what is the best way to do this? I am using PHP4 and MySQL4
Thanks!