February 5, 2003 at 3:27 pm
Good afternoon!
I am stuck on a select statement.
I have a table of prospect communication events. Each prospect has a unique prspct_id
but each prospect has multiple communication events in the table. How can I select for the first (earliest event date) communication event for each prospect?
This is probably simple but I am stuck at the moment. I end up with the earliest communication date in the table, not earliest for each prospect.
Thank you
February 5, 2003 at 6:08 pm
select stuff
from prospects p1
where p1.eventdate = (select min (p2.eventdate) from prospects p2 where p2.prspct = p1.prspct)
February 6, 2003 at 4:39 am
or
select prspct_id,min(eventdate) from prospects group by prspct_id
not sure which is best for performance though!
Far away is close at hand in the images of elsewhere.
Anon.
February 10, 2003 at 10:44 am
Sorry about the delay responding, I do appreciate the help!
Both approaches worked without a noticeable performance difference.
Thanks!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply