homepage Welcome to WebmasterWorld Guest from 107.21.186.38
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library : Charter : Moderators: physics & whoisgregg

Databases Forum

    
Query to return row with max value
Anyone know this off the top of their head?
CernyM




msg:1579915
 10:31 pm on Oct 15, 2005 (gmt 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.

 

bsterz




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

If I understand the question:

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

CernyM




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

Thanks.

I knew it was easy. I hate SQL.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved