Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oracle 9i, sql

Status
Not open for further replies.

cesarnz

Programmer
Aug 11, 2009
2
NZ
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)
 
Hi,
Why are you having the Sql query ( I assume a command) do all the work instead of having Crystal handle the count, group and order?
How many rows of data are you expecting?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
hi,
i dont have access to any reporting tools like crystal so need to format everything in sql command line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top