Allow HAVING clauses without GROUP BY or selecting a summarised column in the Query Builder
on 06-24-201308:31 AM - last edited on 10-10-201511:16 PM by LainieH
At present it is only possible to specify a HAVING clause in the Query Builder if both the following conditions are true:
The query must contain a summarised column
The query must GROUP BY at least one variable
Neither of these conditions is a requirement of the underlying SQL query that the Query Builder writes. This means there is no immediately straightforward way of using the query builder to create the following query (which just tries to pull the tallest person(s) from SASHELP.CLASS):
create table example as
There are workarounds for this, for example creating a new computed column containing a constant and grouping by this as well as including MAX_of_height as a selected column in the query, or with EG 5.1+ there's the option of using a subquery, but I would prefer to be able to build this simple query the simple way!