Top "Aggregate-functions" questions

Aggregate functions are a subset of SQL functions that compute a single value from multiple input rows, mostly used in `SELECT` queries with a `GROUP BY` clause.

group by first character

I have a problem with a query in Oracle SQL. I have a first_name column in an employees table. …

sql group-by aggregate-functions
Oracle / SQL - Count number of occurrences of values in a single column

Okay, I probably could have come up with a better title, but wasn't sure how to word it so let …

sql oracle group-by aggregate-functions
MySQL: GROUP_CONCAT with LEFT JOIN

I'm experiencing a problem with MySQL's "GROUP_CONCAT" function. I will illustrate my problem using a simple help desk database: …

sql mysql join aggregate-functions group-concat
MySql Select, Count(*) and SubQueries in Users<>Comments relations

I have a task to count the quantity of users having count of comments > X. My SQL-query looks like …

mysql sql subquery aggregate-functions
Grouped string aggregation / LISTAGG for SQL Server

I'm sure this has been asked but I can't quite find the right search terms. Given a schema like this: | …

sql sql-server aggregate-functions
How can you use COUNT() in a comparison in a SELECT CASE clause in Sql Server?

Let's say you want do something along the following lines: SELECT CASE WHEN (SELECT COUNT(id) FROM table WHERE column2 = 4) &…

sql sql-server count aggregate-functions select-case
Count rows with a specific condition in aggregate query

I have this query to get the number of PlayerSessions with reconnect = TRUE, grouped by Player.country: SELECT country, COUNT(*) …

mysql sql count subquery aggregate-functions
Custom aggregate function (concat) in SQL Server

Question: I want to write a custom aggregate function that concatenates string on group by. So that I can do …

sql sql-server-2005 sql-server-2008 aggregate-functions aggregation
Using GROUP BY with FIRST_VALUE and LAST_VALUE

I'm working with some data that is currently stored in 1 minute intervals that looks like this: CREATE TABLE #MinuteData ( [Id] …

sql-server group-by aggregate-functions sql-server-2014 analytic-functions
Why can't you mix Aggregate values and Non-Aggregate values in a single SELECT?

I know that if you have one aggregate function in a SELECT statement, then all the other values in the …

sql aggregate-functions