blob: 46c543b94f23d33497c637c4178ce32dbf31445a [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="having">
<title>HAVING Clause</title>
<prolog>
<metadata>
<data name="Category" value="Impala"/>
<data name="Category" value="SQL"/>
<data name="Category" value="Querying"/>
<data name="Category" value="Aggregate Functions"/>
<data name="Category" value="Developers"/>
<data name="Category" value="Data Analysts"/>
</metadata>
</prolog>
<conbody>
<p>
Performs a filter operation on a <codeph>SELECT</codeph> query, by examining the results of aggregation
functions rather than testing each individual table row. Therefore, it is always used in conjunction with a
function such as <codeph><xref href="impala_count.xml#count">COUNT()</xref></codeph>,
<codeph><xref href="impala_sum.xml#sum">SUM()</xref></codeph>,
<codeph><xref href="impala_avg.xml#avg">AVG()</xref></codeph>,
<codeph><xref href="impala_min.xml#min">MIN()</xref></codeph>, or
<codeph><xref href="impala_max.xml#max">MAX()</xref></codeph>, and typically with the
<codeph><xref href="impala_group_by.xml#group_by">GROUP BY</xref></codeph> clause also.
</p>
<p conref="../shared/impala_common.xml#common/restrictions_blurb"/>
<p rev="2.0.0">
The filter expression in the <codeph>HAVING</codeph> clause cannot include a scalar subquery.
</p>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p>
<xref href="impala_select.xml#select"/>,
<xref href="impala_group_by.xml#group_by"/>,
<xref href="impala_aggregate_functions.xml#aggregate_functions"/>
</p>
</conbody>
</concept>