You can use a CASE
statement:
SELECT count(id),
SUM(hour) as totHour,
SUM(case when kind = 1 then 1 else 0 end) as countKindOne
More Related Contents:
- Should I use the datetime or timestamp data type in MySQL?
- Delete all Duplicate Rows except for One in MySQL? [duplicate]
- MySQL string replace
- What is the difference between utf8mb4 and utf8 charsets in MySQL?
- Compare two MySQL databases [closed]
- MySQL – Trigger for updating same table after insert
- How do I get the current time zone of MySQL?
- How to get the difference in years from two different dates?
- Mysql Convert Column to row (Pivot table )
- How to fill in the “holes” in auto-increment fields?
- How to pass parameters to mysql query callback in nodejs
- Is there any reason to worry about the column order in a table?
- MySQL Incorrect datetime value: ‘0000-00-00 00:00:00’
- Clear MySQL query cache without restarting server
- Checking a table for time overlap?
- Does mysql have the equivalent of Oracle’s “analytic functions”?
- How to change MySQL table names in Linux server to be case insensitive?
- MySQL command line formatting with UTF8
- Mysql insert into 2 tables
- MySQL UPDATE and SELECT in one pass
- Use promise to process MySQL return value in node.js
- where does MySQL store database files?
- How can I achieve initcap functionality in MySQL?
- MySQL: How to retrieve a random row or multiple random rows?
- The web application [] appears to have started a thread named [Abandoned connection cleanup thread] com.mysql.jdbc.AbandonedConnectionCleanupThread
- INSERT INTO Table from multiple tables
- Execute INSERT if table is empty?
- Mysql How do you create a clustered index?
- Counting associated entries with Sequelize
- MySQL data directory location