Hey all,
I'm having a hard time getting the output below from a query and was wondering if anyone would be able to reproduce this. Basically I'm trying to retrieve products that have more than 5 sales on a specific date and the retailers they sold at. I have the following simplified table.
I am trying to find which products had more than two sales on the same date, and retrieve the product name, the retailer and the sales
I.E THE ABOVE TABLE WOULD PRODUCE
I've been able to only get the first two fields successfully by using
MY problem is getting the retailers to appear also. Any help would be appreciated.
I'm having a hard time getting the output below from a query and was wondering if anyone would be able to reproduce this. Basically I'm trying to retrieve products that have more than 5 sales on a specific date and the retailers they sold at. I have the following simplified table.
Code:
Table name: SALES
PRODUCT RETAILER SALESDATE
---------------------------------------
PRODUCT1 COMPANY1 10/10/07
PRODUCT1 COMPANY2 10/10/07
PRODUCT2 COMPANY1 10/10/07
I.E THE ABOVE TABLE WOULD PRODUCE
Code:
PRODUCT SALESDATE RETAILER
--------------------------------------
PRODUCT1 10/10/07 COMPANY1
PRODUCT1 10/10/07 COMPANY2
I've been able to only get the first two fields successfully by using
Code:
SELECT PRODUCT, SALESDATE
FROM SALES
GROUP BY SALESDATE, PRODUCT
HAVING (Count(PRODUCT)>=2);
MY problem is getting the retailers to appear also. Any help would be appreciated.