Hello All,

i have a script that records to a table some user information.

1- session id
2- page-visited
3- timein
4- timeout
5- totaltime

my question is how can i get the the average time users spend on a particular page (total average time spend on page), i already have the timein, timeout and total time information which is the result of comparing the timein and timeout records.

Any help is greatly appreciated, thanks.

    Should work in MySQL, not sure how portable it is to other DBMS's:

    SELECT page-visited, AVG(totaltime) AS avg_time FROM table_name GROUP BY page-visited
    
      NogDog wrote:

      Should work in MySQL, not sure how portable it is to other DBMS's:

      SELECT page-visited, AVG(totaltime) AS avg_time FROM table_name GROUP BY page-visited
      

      Thanks NogDog,

      Im assuming the result i get is in seconds format and all i need now is convert this to time format?

        It would be in whatever unit you use for the totaltime field.

          Thanks NogDog, that worked like a charm.

            Write a Reply...