In chapter 25 of The Essence of SQL, Dr. Rozenshtein says, "Given a query tree, it is prohibited to use aggregate functions and/or the GROUP BY or HAVING clauses in any two query blocks where one is a descendant of the other."
I often find myself writing subqueries in FROM clauses, but because of the above, I try to avoid grouping until I absolutely can't anymore. I've gotten conflicting results by putting GROUP BY clauses in the inner and outer queries — sometimes it works, but sometimes I get double grouping. When I ask people more knowledgeable than me, they usually just tell me that there is no such restriction, but that doesn't really answer my question. Rozenshtein is respected in the field, and he mentions the issue a few different times, which leads me to believe that there is some history there. Can someone give me a brief explanation?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…