Hello,
I am tracking page views within modules using the following table:
id | page_id | user_id | session_id | created
Every page is unique to a certain module; so page 14 only exists in module 2, for instance.
I am trying to write a query that tells me when a viewing session began (GROUP BY session_id) for a particular module, but I am having trouble with my ordering. Basically, for that grouped session, I want to return the earliest 'created' (the starting time of the viewing session) and the latest page_id (how far they got within the module).
What is the best way to accomplish this?