Can someone help me filter these results down

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Webbee (Webbee_at_discussions.microsoft.com)
Date: 09/10/04


Date: Thu, 9 Sep 2004 21:07:17 -0700

The idea of this query is to give me contacts that are of the level gold that
I have not contacted in some fashion in order of who I have most recently
contacted last. These results will feed a RSS feed so that I can read this in
my contact program and know who needs to be touched next. Here is what I have
so far.

SELECT TOP 20 Contact1.Company, Contact1.Contact,CASE ContHist.Rectype
                WHEN 'O' THEN 'Other'
                WHEN 'CC' THEN 'Call back'
                WHEN 'A' THEN 'Appointment'
                WHEN 'CI' THEN 'Incoming Call'
                WHEN 'CO' THEN 'Outgoing Call'
                WHEN 'MO' THEN 'Sent E-Mail'
                WHEN 'S' THEN 'Sale'
                END AS 'Action',
        ContHist.UserID,
        ContHist.OnDate
FROM Contact1,ContHist
WHERE Contact1.Accountno = ContHist.Accountno
AND Contact1.Key4 = 'Gold'
ORDER BY ContHist.OnDate

And here are the results I get

Restoration Systems
George Vaughn Call back FRANK 2000-02-01 00:00:00.000 Restoration Systems
George Vaughn Other AL 2000-02-01 00:00:00.000 Restoration Systems
George Vaughn Other ANGIE 2000-02-04 00:00:00.000 Restoration Systems
George Vaughn Call back BILL 2000-02-08 00:00:00.000 Restoration Systems
George Vaughn Other DORIS 2000-02-10 00:00:00.000 Restoration Systems
George Vaughn Other AL 2000-02-15 00:00:00.000 Restoration Systems
George Vaughn Appointment BILL 2000-03-01 00:00:00.000 Restoration Systems
George Vaughn Outgoing Call ROBIN 2000-03-17 00:00:00.000 Restoration Systems
George Vaughn Other WAYNE 2000-03-17 00:00:00.000 Restoration Systems
George Vaughn Incoming Call BILL 2000-03-17 00:00:00.000 Restoration Systems
George Vaughn Outgoing Call MICHAEL 2000-03-23 00:00:00.000 Restoration
Systems
George Vaughn Other JANICE 2000-03-24 00:00:00.000 Restoration Systems
George Vaughn Sent E-Mail ROBIN 2000-03-26 00:00:00.000 Restoration Systems
George Vaughn Sent E-Mail ROBIN 2000-03-26 00:00:00.000 Restoration Systems
George Vaughn Appointment BILL 2000-03-29 00:00:00.000 Restoration Systems
George Vaughn Appointment SUSAN 2000-03-29 00:00:00.000 Restoration Systems
George Vaughn Appointment SUSAN 2000-03-29 00:00:00.000 Restoration Systems
George Vaughn Other JOHNNY 2000-03-30 00:00:00.000 Restoration Systems
George Vaughn Outgoing Call BILL 2000-03-31 00:00:00.000 Restoration Systems
George Vaughn Other JEROME 2000-04-04 00:00:00.000

As you can see I get to many of the same contacts. I only want one of each
record and that record needs to be the one that has been contacted last. With
this information I can show in the RSS Feed something like this

Company, Contact, last touch date, touch type