hi all,
i have an sql statement where i gather all the employees who have sold a product given a certain time period. I can get the data without much problem but the results look like they could be better "grouped". I get this at the moment :
employeename, productID, productType, date, soldAmount
tom 100 1 12/08/2009 1
tom 100 1 12/08/2009 1
tom 100 1 12/08/2009 1
tom 100 1 12/08/2009 1
tom 102 4 12/08/2009 1
tom 102 4 12/08/2009 1
Looking at the results i can see tom sold 4 products (id=100) so i wanted to display something like :
employeename, productID, productType, date, soldAmount
tom 100 1 12/08/2009 4
tom 102 4 12/08/2009 2
any suggestions on how to do this ?? sql so far is :
select employee.name, product.productID, product.productType, sales.date, count(product.productType) "soldAmount"
FROM employee, product, sales WHERE ....
GROUP BY employee.name, product.productID, product.productType, sales.date
ORDER BY count(product.productType)
i have an sql statement where i gather all the employees who have sold a product given a certain time period. I can get the data without much problem but the results look like they could be better "grouped". I get this at the moment :
employeename, productID, productType, date, soldAmount
tom 100 1 12/08/2009 1
tom 100 1 12/08/2009 1
tom 100 1 12/08/2009 1
tom 100 1 12/08/2009 1
tom 102 4 12/08/2009 1
tom 102 4 12/08/2009 1
Looking at the results i can see tom sold 4 products (id=100) so i wanted to display something like :
employeename, productID, productType, date, soldAmount
tom 100 1 12/08/2009 4
tom 102 4 12/08/2009 2
any suggestions on how to do this ?? sql so far is :
select employee.name, product.productID, product.productType, sales.date, count(product.productType) "soldAmount"
FROM employee, product, sales WHERE ....
GROUP BY employee.name, product.productID, product.productType, sales.date
ORDER BY count(product.productType)