Welcome to WebmasterWorld Guest from 54.167.83.224

Forum Moderators: open

Message Too Old, No Replies

Query to return row with max value

Anyone know this off the top of their head?

     
10:31 pm on Oct 15, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 16, 2003
posts:485
votes: 0


TABLE tracking
COLUMNS visitor_id (VARCHAR), page_title (VARCHAR), visit_time (INT)

For a given visitor_id, I need to know the maximum visit_time and the page_title associated with it. Actually, I need a rowset with that data for each unique visitor_id.

Seems like this should have been easy, but it has stumped me.

3:01 am on Oct 16, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:June 20, 2003
posts:558
votes: 0


If I understand the question:

SELECT page_title, MAX(visit_time)
FROM tracking
GROUP BY visitor_id

4:04 am on Oct 16, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 16, 2003
posts:485
votes: 0


Thanks.

I knew it was easy. I hate SQL.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members