Works beautifully! Right before I saw your message I'd hacked together an ugly WTF-worthy query using a total of 5 subqueries, but yours works the same way and much more elegantly.
Thank you!
Works beautifully! Right before I saw your message I'd hacked together an ugly WTF-worthy query using a total of 5 subqueries, but yours works the same way and much more elegantly.
Thank you!
Thanks for the suggestion, but I'm having trouble resolving it in my head.. The relations table would have raw data like:
SESSION: 1, PAGE: 3
SESSION: 1, PAGE: 6
SESSION: 1, PAGE: 4
SESSION: 1, PAGE: 22
SESSION: 2, PAGE: 3
SESSION: 2, PAGE: 11
SESSION: 2, PAGE: 9
SESSION: 3, PAGE: 4
SESSION: 3, PAGE 22
SESSION: 3, PAGE: 9
SESSION: 4, PAGE 22
SESSION: 4, PAGE: 4
....
Basically I'd want to calculate what other pages people that view say page #22 view (in the above example, page 4). See what I mean?
No, wouldn't have to be live, they could definitely be cached, I'm just having trouble figuring out a way to do it that wouldn't make the front page of TDWTF.
I have a simple problem that seems to be beyond my limited mental capabilities. I want to add a feature to my website kind of like Amazon's "Customers also viewed" in order to show my visitors other pages on my site they might be interested in.
So far I have a table of session IDs and a second table linking the session IDs to pages viewed. My question is what's a good way to query these tables (logic only would be fine, I can probably figure out the details) to return results that show correlations between them? To show "Visitors that viewed this page also viewed X, Y, and Z" ?
The WTF reader in me wants to SELECT * FROM each table and loop through, running a separate query for each of the tens of thousands of rows, but although entertaining, that might not be the best way to accomplish this task ;)
I appreciate the help.