Support HAVING in XML queries

GROUP BY에 사용되는 <groups> 태그 안에 <having> 태그를 넣을 수 있습니다.
문법은 <conditions> 부분에 적용되는 것과 같습니다.

<query id="queryId" action="select">
    ...
    <groups>
        <group column="document_srl" />
        <having>
            <condition operation="more" column="document_srl" var="myvar" default="0" />
        </having>
    </groups>
    ...
</query>

결과: SELECT ... GROUP BY document_srl HAVING document_srl >= 0
This commit is contained in:
Kijin Sung 2018-07-03 15:40:52 +09:00
parent 2b5cded376
commit 20fa55a3fc
3 changed files with 89 additions and 6 deletions

View file

@ -711,6 +711,12 @@ class DB
$groupBy = ' GROUP BY ' . $groupBy;
}
$having = $query->getHavingString($with_values);
if($having != '')
{
$having = ' HAVING ' . $having;
}
$orderBy = $query->getOrderByString();
if($orderBy != '')
{
@ -723,7 +729,7 @@ class DB
$limit = ' LIMIT ' . $limit;
}
return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
return "$select $from $where $index_hint_list $groupBy $having $orderBy $limit";
}
/**