About 69,700 results
Open links in new tab
  1. Why are aggregate functions not allowed in where clause

    34 Why can't we use aggregate function in where clause Aggregate functions work on sets of data. A WHERE clause doesn't have access to entire set, but only to the row that it is currently …

  2. sql - TSQL Pivot without aggregate function - Stack Overflow

    sql parameterised cte query The answer to that question involves a situation where pivot without aggregation is needed so an example of doing it is part of the solution.

  3. SQL Server pivot on 2 (or multiple) aggregates - Stack Overflow

    Jul 27, 2017 · Is it possible to pivot on multiple aggregated columns in SQL Server? I have the following order table:

  4. Aggregate function in SQL WHERE-Clause - Stack Overflow

    May 13, 2014 · In a test at university there was a question; is it possible to use an aggregate function in the SQL WHERE clause. I always thought this isn't possible and I also can't find …

  5. select - SQL: How to filter after aggregation? - Stack Overflow

    Apr 2, 2013 · SELECT department, SUM(sales) as "Total sales" FROM order_details GROUP BY department HAVING SUM(sales) > 1000; Which will exclude all sales with a value less than or …

  6. SQL GROUP BY CASE statement with aggregate function

    And I would like to put it in my GROUP BY clause, but this seems to cause problems because there is an aggregate function in column. Is there a way to GROUP BY a column alias such as …

  7. SQL Server Pivot Table with multiple column aggregates

    I would do this slightly different by applying both the UNPIVOT and the PIVOT functions to get the final result. The unpivot takes the values from both the totalcount and totalamount columns …

  8. Aggregate SQL Function to grab only the first from each group

    Apr 21, 2017 · 2 First and Last do not exist in Sql Server 2005 or 2008, but in Sql Server 2012 there is a First_Value, Last_Value function. I tried to implement the aggregate First and Last …

  9. Aggregate on datetime in sql with group by - Stack Overflow

    Jun 24, 2016 · The following are available aggregate functions for SQL AVG() - Returns the average value COUNT() - Returns the number of rows FIRST() - Returns the first value …

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