 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I count visitors per page per day using MySQL?
Note: We assume we have created a database named ‘DBNAME’ and a table named ‘tableName’.
Let us understand how the count of visitors per day per page can be queried using MySQL. This can be done using the bit group function −
Query
SELECT DATE(date) Date, page_id, COUNT(*) colName FROM tableName GROUP BY DATE(date), page_id
Here ‘colName’ refers to the ‘visits per day’ column, and ‘tableName’ refers to the table that contains details about visitors.
It makes sure that the duplicate values in the table are removed when the above query is run.
Advertisements
 