About 50 results
Open links in new tab
  1. 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 …

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

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

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

  5. How to use group by in SQL Server query? - Stack Overflow

    The GROUP BY statement is often used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result-set by one or more columns. In case,you are trying to achieve any …

  6. sql - How can I group time by hour or by 10 minutes? - Stack …

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

  7. In SQL, how can you "group by" in ranges? - Stack Overflow

    In SQL, how can you "group by" in ranges? Asked 17 years, 2 months ago Modified 1 year, 5 months ago Viewed 251k times

  8. sql - Understanding how WHERE works with GROUP BY and …

    SQL does allow you to filter on the results of a GROUP BY -- it's called the HAVING clause. If you want to filter on something that could be determined prior to the grouping (i.e. everyone with …

  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 …

  10. How to use GROUP BY to concatenate strings in SQL Server?

    How to use GROUP BY to concatenate strings in SQL Server? Asked 17 years, 2 months ago Modified 1 year, 10 months ago Viewed 940k times