About 10,900,000 results
Open links in new tab
  1. 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 …

  2. sql - Select max value of each group - Stack Overflow

    The select list has 2 fields: name and value. Name is in the group by clause and value is aggregated via max. I cannot see any version of the answer where there would have been …

  3. 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 …

  4. sql - How to combine GROUP BY and ROW_NUMBER? - Stack …

    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 …

  5. 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 …

  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 …

  7. 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 …

  8. Check users in a security group in SQL Server - Stack Overflow

    In the Security/Users folder in my database, I have a bunch of security groups, include "MyApplication Users". I need to check if I am (or another user is) in this group, but I have no …

  9. sql - Get top 1 row of each group - Stack Overflow

    Jul 27, 2011 · The select top 1 with ties clause tells SQL Server that you want to return the first row per group. But how does SQL Server know how to group up the data? This is where the …

  10. sql - How to use count and group by at the same select statement ...

    Apr 27, 2010 · I have an SQL SELECT query that also uses a GROUP BY, I want to count all the records after the GROUP BY clause filtered the resultset. Is there any way to do this directly …