Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:02:38+00:00 2026-05-29T23:02:38+00:00

I have a video site and I’m storing hit statistics in a table like

  • 0

I have a video site and I’m storing hit statistics in a table like this:

+------------+------------------+------+-----+-------------------+----------------+
| Field      | Type             | Null | Key | Default           | Extra          |
+------------+------------------+------+-----+-------------------+----------------+
| id         | int(10) unsigned | NO   | PRI | NULL              | auto_increment |
| user_id    | int(10) unsigned | NO   | MUL | NULL              |                |
| video_id   | int(10) unsigned | NO   | MUL | NULL              |                |
| user_agent | varchar(500)     | NO   |     | NULL              |                |
| ip         | varchar(255)     | NO   |     | NULL              |                |
| date_add   | timestamp        | NO   | MUL | CURRENT_TIMESTAMP |                |
+------------+------------------+------+-----+-------------------+----------------+

I want show stats daily (like 2012-02-14: 5000 web views, 850 iphone views), like this:

+---------------------+---------+---------------+
| date                | web     | iphone        |
+---------------------+---------+---------------+
| 2012-02-09          |    500  | 478           |
| 2012-02-10          |    2377 | 204           |
| 2012-02-12          |    247  | 21            |
| 2012-02-13          |    4879 | 236           |
| 2012-02-14          |    8767 | 101           |
+---------------------+---------+---------------+

The iPhone user ID is 2422, the others are web users.

I’m sorry for my bad English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:02:40+00:00Added an answer on May 29, 2026 at 11:02 pm
    SELECT DATE(date_add) AS date, 
           SUM(CASE WHEN user_id = 2422 THEN 0 ELSE 1 END) AS Web,
           SUM(CASE WHEN user_id = 2422 THEN 1 ELSE 0 END) AS iPhone
    FROM stats
    GROUP by DATE(date_add)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this site i am working on: www.guygar.com the quicktime renders the video
I'm creating a mobile site where I have a video I'd like to play
I have a small video site where I want to get related videos on
I have jQuery on my site. I also have a youtube video using a
I have a site that allows people to upload large video files in various
We have been requested to stream a single video (+500MB) from a web site.
I have a video sharing site, it uses phpmotion , i tried cliipbucket also,
I have a very large CDN purge server. It is structured like so site.com/
I have site that has a Vimeo video where the client wants to hide
I have an image/video hosting site. In the likes of imgur. A lot of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.