Hello, All.
I am developing some reports to be used with a company's phone call accounting and CRM systems. For discussion purposes, let me set this scenario: Each employee is assigned a number of leads, whom they are expected to call. They may call each lead a number of times. I want my report to display the employee, the lead, and the earliest (min) date that a call was made to that lead. Here is a table and sample data:
With this data, I would want to see
I've tried various groupings in my select, but I always end up with 7 rows instead of 4.
Can you please help me solve this problem?
Thanks so much!
Mike
I am developing some reports to be used with a company's phone call accounting and CRM systems. For discussion purposes, let me set this scenario: Each employee is assigned a number of leads, whom they are expected to call. They may call each lead a number of times. I want my report to display the employee, the lead, and the earliest (min) date that a call was made to that lead. Here is a table and sample data:
Code:
Create Table MyCallRecord
(EmployeeName varchar(10), LeadName varchar(10),
PhoneNumberCalled varchar(15),
DateCalled smalldatetime)
Insert Into MyCallRecord
Select 'Moe', 'Sneezy','816-555-1212', '7/17/2008'
Union All
Select 'Moe', 'Sneezy', '816-555-1212', '7/18/2008'
Union All
Select 'Moe', 'Grumpy', '913-555-5555', '7/22/2008'
Union All
Select 'Moe', 'Grumpy', '913-555-1111', '7/20/2008'
Union All
Select 'Larry', 'Dopey', '816-555-0000', '7/14/2008'
Union All
Select 'Shemp', 'Bashful', '417-555-8262', '7/1/2008'
Union All
Select 'Shemp', 'Bashful', '417-555-8262', '7/5/2008'
With this data, I would want to see
Code:
Moe Sneezy 816-555-1212 7/17/2008
Moe Grumpy 913-555-1111 7/20/2008
Larry Dopey 816-555-0000 7/14/2008
Shemp Bashful 417-555-8262 7/1/2008
I've tried various groupings in my select, but I always end up with 7 rows instead of 4.
Can you please help me solve this problem?
Thanks so much!
Mike