First, why your query gives you duplicate records? Are they really duplicates ?
You can prevent this by going to SQL mode of a query and typing after the Select - distinct. so that SQL would look like
Select distinct ............
ok maybe I didn't explain this well. I am new to working with databases. Pretty much I have two tables one customer table and one sales table. The sales table has all the invoices in it. I am trying to automate a rebate system for one of our vendors. I need a report that lists invoices by account and gives me totals of how many parts each account got and total invoices for the whole report and for each account. With one query I was able to do all of this except for counting the invoices becuase the sales table will have duplicate invoice numbers when there were mutliple parts being solf on one invoice. I hope that helps some.