heh, google can be too revealing sometimes I tell you. There is stuff from like 1996 that I participated in that somehow got indexed in the google groups "bank of knowledge". We're talking serious old school at that point, at least for me.
Anyhow I digress, thanks again for the...
Yeah that was me. :) I really should finish up that degree at some point... <sigh>
Man that was some time ago, back when I was creating this CMS for the company I work for. Remember helping me with that? You introduced me to the having clause, which I've been abusing ever since then with...
lol, I was webguy on that list, only on it for a few months though. You are a legend as far as I'm concerned! :D I mean that in a not-old-just-know-it-for-sure way, promise.
So you are right again, I, um, lazily edited my original query to slide yours in with minimal wrist strain and forgot...
Rudy, just tried your suggestion, and what it is doing is returning the max (highest) page_number records, with associated user_ids. So for example:
1|20
2|21
2|20
2|19
3|15
5|2
5|1
6|12
7|13
If I wanted to get the top 3 user_ids based on the max page_number they reached, my statement above...
Rudy hey man, how are you? I remember you from the evolt mailing list, which I am no longer a part of (too much email these days). Thanks for the tip, you were always the db guru.
So my sql above is just a longer version of what you wrote there, correct? Probably less efficient too. :)
Hah! Well looks like I just solved my own problem. I knew I needed to group differently and order the results, but I didn't think this would actually work! But it does.
SELECT TOP 10 a.user_id, a.page_number
FROM activity_table a
GROUP BY a.user_id, a.page_number
HAVING a.page_number = (...
I'm trying to generate a little report based on some data.
The data structure is like this:
user_id page_number
------------------------
1 22
1 21
1 20
3 18
3 17
6 23
6 22
...
...
Basically it's a list of...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.