This question comes up every couple of months or so.  It's a
basic misunderstanding of how grouping works.

The answer in your case is

  select Visitor_ID, Action, Message, Timestamp
  from av2, (select Visitor_ID vid, max(Timestamp) mts
             from av2 where Action='I' or Action='O'
             group by vid)
  where Visitor_ID = vid and Timestamp = mts;

If you want to see why this works, you can look at

  http://www.mail-archive.com/[EMAIL PROTECTED]/msg02154.html

and

  http://www.mail-archive.com/[EMAIL PROTECTED]/msg01118.html

and follow the threads backward and forward.

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to