Home >Database >Mysql Tutorial >How to count the number of visitors to each page per day using MySQL?
Note: We assume that we have created a database named "DBNAME" and a table named "tableName".
Let us understand how we can query the number of visitors per page per day using MySQL. This can be done using bit array functions -
SELECT DATE(date) Date, page_id, COUNT(*) colName FROM tableName GROUP BY DATE(date), page_id
Here "colName" refers to the "Daily Visits" column and "tableName" refers to the column containing the visitor details table.
It ensures that duplicate values in the table are removed when running the above query.
The above is the detailed content of How to count the number of visitors to each page per day using MySQL?. For more information, please follow other related articles on the PHP Chinese website!