Top "Group-by" questions

GROUP BY is a command in the SQL relational database standard for collapsing a group of rows that share common field value(s) into a single row.

GROUP BY with MAX(DATE)

I'm trying to list the latest destination (MAX departure time) for each train in a table, for example: Train Dest …

sql oracle group-by greatest-n-per-group ora-00979
MySQL order by before group by

There are plenty of similar questions to be found on here but I don't think that any answer the question …

mysql group-by sql-order-by
Is it possible to GROUP BY multiple columns using MySQL?

Is it possible to GROUP BY more than one column in a MySQL SELECT query? For example: GROUP BY fV.…

mysql sql group-by
LINQ with groupby and count

This is pretty simple but I'm at a loss: Given this type of data set: UserInfo(name, metric, day, other_…

c# linq group-by
How to concatenate strings of a string field in a PostgreSQL 'group by' query?

I am looking for a way to concatenate the strings of a field within a group by query. So for …

sql postgresql group-by string-aggregation
How to group time by hour or by 10 minutes

like when I do SELECT [Date] FROM [FRIIB].[dbo].[ArchiveAnalog] GROUP BY [Date] how can I specify the group period ? …

sql sql-server-2008 tsql group-by
pandas groupby sort within groups

I want to group my dataframe by two columns and then sort the aggregated results within the groups. In [167]: df …

python sorting pandas group-by
Count number of records returned by group by

How do I count the number of records returned by a group by query, For eg: select count(*) from temptable …

sql-server tsql count group-by
GROUP BY + CASE statement

I have a working query that is grouping data by hardware model and a result, but the problem is there …

sql postgresql group-by case aggregate-functions