Select
Count(Distinct user_id) As countUsers
, Count(site_id) As countVisits
, site_id As site
From cp_visits
Where ts >= DATE_SUB(NOW(), INTERVAL 1 DAY)
Group By site_id
More Related Contents:
- Recreating a query using INNER JOIN? [duplicate]
- Create a Cumulative Sum Column in MySQL
- Equivalent of explode() to work with strings in MySQL
- 1064 error in CREATE TABLE … TYPE=MYISAM
- mysql select dynamic row values as column names, another column as value
- Access denied for user ‘root’@’localhost’ (using password: YES) (Mysql::Error)
- Setting up MySQL and importing dump within Dockerfile
- MySQL DELETE FROM with subquery as condition
- SQL – IF EXISTS UPDATE ELSE INSERT INTO
- SELECT / GROUP BY – segments of time (10 seconds, 30 seconds, etc)
- Simple Random Samples from a Sql database
- How to convert number of week into date?
- count(*) and count(column_name), what’s the diff?
- MySQL Select Date Equal to Today (having datetime as the data type)
- mysql root password forgotten
- How to deploy local MySQL database to Heroku
- Should I use MySQL blob field type?
- MySQL Cannot drop index needed in a foreign key constraint
- MySQL Insert & Joins
- Does MySQL overwrite a column of same value on update?
- How to make join queries using Sequelize on Node.js
- How to join two tables using a comma-separated-list in the join field
- mysql like performance boost
- MySQL selecting yesterday’s date
- Does MySQL included with MAMP not include a config file?
- How do I write an SP in phpMyAdmin (MySQL)?
- The web application [] appears to have started a thread named [Abandoned connection cleanup thread] com.mysql.jdbc.AbandonedConnectionCleanupThread
- MySQL: Querying for unicode entities
- undefined method `eq’ for nil:NilClass with rails 3 and ruby enterprise on ubuntu hardy
- INSERT INTO fails with node-mysql