About 14,600,000 results
Open links in new tab
  1. Count number of records returned by group by - Stack Overflow

    Jun 16, 2016 · The group by doesn't change the number of rows though. 1 + 1 + 2 (in your example) will be the number of rows in the table. Are you looking for 3? The number of distinct groups?

  2. sql - How to combine GROUP BY and ROW_NUMBER? - Stack Overflow

    What i need is commented above, a way to get the ROW_NUMBER but also to Group By in the first place. So i need the sum of all T1-prices grouped by T2.ID in the relation-table and in the outer query …

  3. sql server - row_number () Group by? - Stack Overflow

    Sep 21, 2012 · This is what I want my result set to look like: By using the SQL query below, I'm able to get row using the row_number() function. However, I can't get that unique column that I have …

  4. sql - How can I group time by hour or by 10 minutes? - Stack Overflow

    How do you group by whole date and by hours in the same time? I'm just using Min Date .

  5. What is the difference between PARTITION BY and GROUP BY

    The SQL GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns. In more simple words GROUP BY statement is used …

  6. sql - Select first row in each GROUP BY group? - Stack Overflow

    Sep 27, 2010 · I'd like to select the first row of each set of rows grouped with a GROUP BY. Specifically, if I've got a purchases table that looks like this: SELECT * FROM purchases; My Output: id customer …

  7. How to return a incremental group number per group in SQL

    Jan 16, 2013 · I would like create a data query in SQL to incrementally number groups of rows, grouped on a common datetime and keep the "group numbers" incrementing on the next datetime and so on. …

  8. SQL Inner Join with Group By - Stack Overflow

    Dec 12, 2013 · 0 Besides adding entries in your group by statement, you could also write it as a CTE using the with statement. You define the result set of the sums first, and then use a second query …

  9. Get records with max value for each group of grouped SQL results

    Aug 24, 2012 · How do you get the rows that contain the max value for each grouped set? I've seen some overly-complicated variations on this question, and none with a good answer. I've tried to put …

  10. sql - Increment Row Number on Group - Stack Overflow

    Jun 20, 2012 · I am working on a query for SQL Server 2005 that needs to return data with two 'index' fields. The first index 't_index' should increment every time the 'shade' column changes, whilst the …