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

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

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

  4. aggregate functions - Can we use SQL Server STRING_AGG () in queries ...

    Mar 29, 2023 · Aggregate functions that are used with CUBE, ROLLUP, or GROUPING SET queries must provide for the merging of subaggregates. To fix this problem, remove the aggregate function …

  5. sql - Query with aggregate functions is very slow - Stack Overflow

    Sep 9, 2025 · Query with aggregate functions is very slow Asked 4 months ago Modified 4 months ago Viewed 161 times

  6. sql - Why can't you mix Aggregate values and Non-Aggregate values …

    If you use an aggregate, but doesn't specify any grouping, the query will still be grouped, and the entire result is a single group. So the query select count(*) from Person will create a single group …

  7. Difference between scalar, table-valued, and aggregate functions in …

    Jul 14, 2016 · What is the difference between scalar-valued, table-valued, and aggregate functions in SQL server? And does calling them from a query need a different method, or do we call them in the …

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

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

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