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 in LINQ

Let's suppose if we have a class like: class Person { internal int PersonID; internal string car; } I have a list …

c# linq group-by
Using group by on multiple columns

I understand the point of GROUP BY x. But how does GROUP BY x, y work, and what does it …

sql group-by multiple-columns
Select first row in each GROUP BY group?

As the title suggests, I'd like to select the first row of each set of rows grouped with a GROUP …

sql sqlite postgresql group-by greatest-n-per-group
Get statistics for each group (such as count, mean, etc) using pandas GroupBy?

I have a data frame df and I use several columns from it to groupby: df['col1','col2',…

python pandas dataframe group-by pandas-groupby
Retrieving the last record in each group - MySQL

There is a table messages that contains data as shown below: Id Name Other_Columns ------------------------- 1 A A_data_1 2 A …

sql mysql group-by greatest-n-per-group
How to use count and group by at the same select statement

I have an sql select query that has a group by. I want to count all the records after the …

sql count group-by
MySQL Query GROUP BY day / month / year

Is it possible to make a simple query to count how many records I have in a determined period of …

mysql sql date datetime group-by
Get top 1 row of each group

I have a table which I want to get the latest entry for each group. Here's the table: DocumentStatusLogs Table |…

sql tsql sql-server-2005 group-by greatest-n-per-group
SQL query for finding records where count > 1

I have a table named PAYMENT. Within this table I have a user ID, an account number, a ZIP code …

sql count group-by having