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 to combine/concat a column

I have a table as follow: ID User Activity PageURL 1 Me act1 ab 2 Me act1 cd 3 You act2 xy 4 You …

sql sql-server sql-server-2008 group-by
LINQ Group By and select collection

I have this structure Customer - has many Orders - has many OrderItems I want to generate a list of …

c# linq group-by
What's faster, SELECT DISTINCT or GROUP BY in MySQL?

If I have a table CREATE TABLE users ( id int(10) unsigned NOT NULL auto_increment, name varchar(255) NOT NULL, profession …

mysql sql database group-by distinct
SQL query to group by day

I want to list all sales, and group the sum by day. Sales (saleID INT, amount INT, created DATETIME) NOTE: …

sql sql-server sql-server-2005 group-by
Select multiple columns from a table, but group by one

The table name is "OrderDetails" and columns are given below: OrderDetailID || ProductID || ProductName || OrderQuantity I'm trying to select multiple columns …

sql group-by
SQL - using alias in Group By

Just curious about SQL syntax. So if I have SELECT itemName as ItemName, substring(itemName, 1,1) as FirstLetter, Count(itemName) FROM …

sql group-by alias
Python group by

Assume that I have a set of data pair where index 0 is the value and index 1 is the type: input = [ (…

python group-by
Relative frequencies / proportions with dplyr

Suppose I want to calculate the proportion of different values within each group. For example, using the mtcars data, how …

r group-by dplyr frequency
SQL: Group by minimum value in one field while selecting distinct rows

Here's what I'm trying to do. Let's say I have this table t: key_id | id | record_date | other_cols 1 | 18 | 2011…

sql group-by max distinct min
Pandas sum by groupby, but exclude certain columns

What is the best way to do a groupby on a Pandas dataframe, but exclude some columns from that groupby? …

python pandas group-by aggregate