However, consider avoiding the inefficient correlated subquery to run for every row in table to joining on an aggregate query for the MAX calculated once and then run aggregation again for COUNT on main level. Consider using a derived table to first run your unit level with subquery and then in outer main query run your aggregation. Currently, you are attempting to run a correlated subquery in the SELECT clause encapsulated in an aggregate query and then reference this very subquery by alias in the GROUP BY clause.Ĭonsider using a derived table to first run your unit level with subquery and then in outer main query run your aggregation. Currently, you are attempting to run a correlated subquery in the SELECT clause encapsulated in an aggregate query and then reference this very subquery by alias in the GROUP BY clause.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |