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.

Huge performance difference when using group by vs distinct

I am performing some tests on a HSQLDB server with a table containing 500 000 entries. The table has no indices. There …

sql performance group-by distinct hsqldb
LINQ: combining join and group by

I have a query that combines a join and a group, but I have a problem. The query is like: …

c# linq linq-to-sql join group-by
Group by & count function in sqlalchemy

I want a "group by and count" command in sqlalchemy. How can I do this?

python group-by count sqlalchemy
ORDER BY date and time BEFORE GROUP BY name in mysql

i have a table like this: name date time tom | 2011-07-04 | 01:09:52 tom | 2011-07-04 | 01:09:52 mad | 2011-07-04 | 02:10:53 mad | 2009-06…

mysql sorting group-by sql-order-by
How to group by week in MySQL?

Oracle's table server offers a built-in function, TRUNC(timestamp,'DY'). This function converts any timestamp to midnight on the previous …

mysql datetime group-by data-migration dayofweek
GroupBy pandas DataFrame and select most common value

I have a data frame with three string columns. I know that the only one value in the 3rd column …

python pandas group-by pandas-groupby mode
Using LINQ to group a list of objects

I have an object: public class Customer { public int ID { get; set; } public string Name { get; set; } public int GroupID { …

c# linq group-by linq-to-objects
MySQL joins and COUNT(*) from another table

I have two tables: groups and group_members. The groups table contains all the information for each group, such as …

mysql count group-by left-join having
getting "No column was specified for column 2 of 'd'" in sql server cte?

I have this query, but its not working as it should, with c as (select month(bookingdate) as duration, count(*) …

sql sql-server group-by common-table-expression calculated-columns
mysql query: SELECT DISTINCT column1, GROUP BY column2

Right now I have the following query: SELECT name, COUNT(name), time, price, ip, SUM(price) FROM tablename WHERE time &…

mysql select group-by distinct