SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    get avg time on site by gender

    Hi,
    I'm in a doubt is it right this query
    PHP Code:
    SELECT A.domain_id AS domain_idU.sesso AS fieldNULL AS subfieldCASTA.access_start_datetime AS DATE ) AS DATEAVGTIMESTAMPDIFF
    MINUTE A.access_start_datetimeA.access_end_datetime ) ) AS value
    FROM stats_access A
    JOIN users U ON U
    .id A.fb_id
    WHERE 
    (
    A.fb_id IS NOT NULL
    )
    GROUP BY A.domain_idfieldCASTA.access_start_datetime AS DATE 
    to get the avg time on site by gender ?
    and how the group like
    0-10 minutes
    10-20 minutes
    20-30 minutes
    ....

  2. #2
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    SELECT A.domain_id AS domain_idU.sesso AS fieldNULL AS subfield
    CASTA.access_start_datetime AS DATE ) AS DATE
    CASE 
        
    WHEN AVGTIMESTAMPDIFFMINUTE A.access_start_datetimeA.access_end_datetime ) ) <10
            THEN  
    '0-10'
        
    WHEN AVGTIMESTAMPDIFFMINUTE A.access_start_datetimeA.access_end_datetime ) ) >11 <21
            THEN  
    '10-20'
        
    WHEN AVGTIMESTAMPDIFFMINUTE A.access_start_datetimeA.access_end_datetime ) ) >21 <31
            THEN  
    '20-30'
        
    ELSE  '30+'
         
    END AS value
    FROM sharint_stats_access A
    JOIN sharint_users U ON U
    .id A.fb_id
    WHERE 
    (A.fb_id IS NOT NULL)
    GROUP BY A.domain_idfieldCASTA.access_start_datetime AS DATE 
    is it ok ?

  3. #3
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    SELECT A.domain_id AS domain_idU.gender AS field
    CASTA.access_start_datetime AS DATE ) AS DATE
    CASE 
        
    WHEN AVGTIMESTAMPDIFFMINUTE A.access_start_datetimeA.access_end_datetime ) ) <10
            THEN  
    '0-10'
        
    WHEN AVGTIMESTAMPDIFFMINUTE A.access_start_datetimeA.access_end_datetime ) ) >11 <21
            THEN  
    '10-20'
        
    WHEN AVGTIMESTAMPDIFFMINUTE A.access_start_datetimeA.access_end_datetime ) ) >21 <31
            THEN  
    '20-30'
        
    ELSE  '30+'
         
    END AS subfield,
    avg(timestampdiff(MINUTE,A.access_start_datetime,A.access_end_datetime)) AS value
    FROM stats_access A
    JOIN users U ON U
    .id A.fb_id
    WHERE 
    (A.fb_id IS NOT NULL)
    GROUP BY A.domain_idfieldCASTA.access_start_datetime AS DATE 
    better


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •