[thelist] SQL Question

Judah McAuley judah at wiredotter.com
Thu Jun 27 17:03:12 CDT 2002


Roger Ly wrote:
> But, since I am trying to see how many users logs in with, say Netscape, I want
> to filter out all duplicate user logins with the same UserAgent.  So, if a user
> logs in twice with Netscape 4.73, I want to log that as one Netscape 4.73, but
> if a user logs in once with Netscape 4.51 and once with IE 6.01, I want to log
> it as one for each.
>
> This sounds pretty simple to me, but I can't seem to get it to return the
> correct results.
>
> Let's just assume tblUserSessions is just (userID, userAgent)


I believe that is should just be as simple as adding the userID column
to the SELECT and GROUP BY statements as so:

SELECT COUNT(userAgent), userID, userAgent
FROM tblUserSessions
GROUP BY userID, userAgent
ORDER BY userAgent

Hope thats right and hope that helps

Judah




More information about the thelist mailing list