SELECT t1.ks, t1.[# Tasks], COALESCE(t2.[# Late], 0) AS [# Late]
FROM
(SELECT ks, COUNT(*) AS '# Tasks' FROM Table GROUP BY ks) t1
LEFT JOIN
(SELECT ks, COUNT(*) AS '# Late' FROM Table WHERE Age > Palt GROUP BY ks) t2
ON (t1.ks = t2.ks);
More Related Contents:
- SQL update from one Table to another based on a ID match
- SQL join: selecting the last records in a one-to-many relationship
- SQL SELECT from multiple tables
- What is the result of following SQL Query?
- Join vs. sub-query
- Can I use CASE statement in a JOIN condition?
- What is the difference between Left, Right, Outer and Inner Joins? [duplicate]
- Subqueries vs joins
- Difference between left join and right join in SQL Server [duplicate]
- Ms Access Query: Concatenating Rows through a query
- Difference between natural join and inner join
- Are “from Table1 left join Table2” and “from Table2 right join Table1” interchangeable?
- What is the difference between using a cross join and putting a comma between the two tables?
- Natural join in SQL Server
- Including null values in an Apache Spark Join
- Select only rows by join tables max value
- Select TOP X (or bottom) percent for numeric values in MySQL
- How to kill a running SELECT statement
- DATEDIFF function in Oracle [duplicate]
- How to select multiple rows filled with constants?
- How to select only the first rows for each unique value of a column?
- What is semi-join in database?
- sql group by only rows which are in sequence
- MySQL GROUP BY behavior
- SQL server join tables and pivot
- SQL: How do you select only groups that do not contain a certain value?
- How to select records without duplicate on just one field in SQL?
- SQL: Select rows with a column value that occurs at least N times?
- Is NATURAL (JOIN) considered harmful in production environment?
- How to do a case sensitive GROUP BY?