Hi all:
Here is the problem I have. The table I have has the following fields:
Address
Price
City
State
Zip
FirstName
LastName
SalesType
"Sales Type" can be 1 or 2. First Name and Last Name correspond to the Sales Person's name. I need to be able to build a query that will count the number of addresses each sales person has sold and the sum of his sales. The query would be logically as follows
Select DISTINCT FirstName&" "&LastName, sum(Price), Count(Price)
group by DISTINCT FirstName&" "&LastName;
However, it does not work because there are transactions where the sales person could have "sales type" 1 or 2 for the same address. So an address would be entered twice for the same sales person (once for SalesType 1 and once for 2) and the above query would count that as two transactions. At the same type I cannot add "Having SalesType = 1 or 2" becuase there are some sales people who have either 1 or 2 as the sales type but not both.
I hope the explanation is clear. What should I use to solve this issue?
Ideally I want the sum and count for each address.
Thanks.
Here is the problem I have. The table I have has the following fields:
Address
Price
City
State
Zip
FirstName
LastName
SalesType
"Sales Type" can be 1 or 2. First Name and Last Name correspond to the Sales Person's name. I need to be able to build a query that will count the number of addresses each sales person has sold and the sum of his sales. The query would be logically as follows
Select DISTINCT FirstName&" "&LastName, sum(Price), Count(Price)
group by DISTINCT FirstName&" "&LastName;
However, it does not work because there are transactions where the sales person could have "sales type" 1 or 2 for the same address. So an address would be entered twice for the same sales person (once for SalesType 1 and once for 2) and the above query would count that as two transactions. At the same type I cannot add "Having SalesType = 1 or 2" becuase there are some sales people who have either 1 or 2 as the sales type but not both.
I hope the explanation is clear. What should I use to solve this issue?
Ideally I want the sum and count for each address.
Thanks.