Getting max. screen resolution with Group By
Posted
by Quandary
on Stack Overflow
See other posts from Stack Overflow
or by Quandary
Published on 2010-04-15T10:59:48Z
Indexed on
2010/04/15
11:03 UTC
Read the original article
Hit count: 252
sql
|sql-server-2005
Question:
I have a website where I gather browser statistics.
I have an SQL table (T_Visits), with the following columns:
uniqueidentifier Visit_UID,
uniqueidentifier User_UID,
datetime Visit_DateTime,
float Screen_w,
float Screen_h,
float Resolution = Screen_w * Screen_h
varchar resolutionstring = screen_w + ' x ' + screen_h
Now I want to get the maximum/minimum resolution each user had:
Select User_UID, max(resolution) from T_Visits GROUP BY User_UID
How can I get the corresponding resolution string ?
I mean I can get the max(screen_w) and max(screen_h), but there's no guarantee that the corresponding resolutionstring would be max(screen_w) +' x '+ max(screen_h)
© Stack Overflow or respective owner