About 84,900 results
Open links in new tab
  1. SQL GROUP BY CASE statement with aggregate function

    SQL GROUP BY CASE statement with aggregate function Asked 16 years, 4 months ago Modified 2 years, 5 months ago Viewed 345k times

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

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

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

  5. How to avoid error "aggregate functions are not allowed in WHERE"

    Jan 8, 2014 · This sql code throws an aggregate functions are not allowed in WHERE SELECT o.ID , count (p.CAT) FROM Orders o INNER JOIN Products p ON o.P_ID = p.P_ID WHERE count (p.CAT) …

  6. Why do we need GROUP BY with AGGREGATE FUNCTIONS?

    Dec 22, 2012 · 4 If you don't specify GROUP BY, aggregate functions operate over all the records selected. In that case, it doesn't make sense to also select a specific column like EmployeeID.

  7. 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 any example how it …

  8. sql - GROUP BY without aggregate function - Stack Overflow

    Nov 19, 2013 · SQL requires that if a column is in the SELECT clause and is not used within an aggregate function, it must be included in the GROUP BY clause. Since resource.rId is selected but …

  9. How do I select columns together with aggregate functions?

    Jun 23, 2012 · If I use GROUP BY coID, I get Incorrect syntax near the keyword 'WHERE'. If I change the WHERE to HAVING because of the aggregate functions, I get errors telling me to remove each …

  10. Is there really no First/Last aggregate function in T-SQL?

    Aug 24, 2023 · 3 Is there really no First/Last aggregate function in T-SQL? No - there are no such aggregate functions in TSQL. The problem with FIRST and LAST is that you need a way of …