First let me say I have never taken any classes on sql. We just started supporting a new POS and it uses a access database, I am just learning this as I go. This is the statement I currently have.
select C.FNAME, C.LNAME, C.BNAME, C.AC1, C.PHONE1, C.EMAIL, H.RO_NO, T.TECH_NAME, H.RODATE, H.TOTAL
from (CUSTOMER AS C
inner join HRO AS H
on C.CUST_NO=H.CUST_NO)
inner join Tech AS T
on H.WRITER=T.TECH
where H.RODATE between #1/01/2012# and #4/25/2012# and H.TOTAL>1000 order by H.TOTAL DESC
This pulls up the correct info, but it will pull duplicates if the customer has come in multiple times in the date selected. I want to know if there is a select statement where it will look for duplicate names, add the total column up and only print out one instance of that customer with the sum of the total column.
it currently pulls like this
FNAME | LNAME | BNAME | AC1 | PHONE1 | RO_NO | TECH_NAME | RODATE | TOTAL |
RICHARD | B | B, RICHARD | 555 | 555-5555 | 0091495 | TED | 4/6/2012 | 2466.53000 |
RICHARD | B | B, RICHARD | 555 | 555-5555 | 0091212 | TED | 3/20/2012 | 1234.77000 |
I want it to pull like this
RICHARD | B | B, RICHARD | 555 | 555-5555 | 0091495 | TED | ******* | 3701.3000 |
I don't care about the date column, it's just there for reference right now.
Any input on this will be greatly appreciated.
Thank,
Jeff