AstVisitor, Query, SelectCombiningQueryStep, SelectFinalStep, SelectLimitStep, SelectLockingStep, SelectOffsetStep, SelectOrderByStepSelectGroupByStep, SelectJoinManyStepsStep, SelectJoinOnFirstStep, SelectJoinOnManySteps, SelectJoinStep, SelectWhereFirstStep, SelectWhereManyStepsSelectImplpublic interface SelectHavingFirstStep extends SelectCombiningQueryStep
| Modifier and Type | Method | Description |
|---|---|---|
SelectHavingManySteps |
having(Conditions conditions) |
This function useful in a few case:
When the
conditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc. |
<T> SelectHavingManySteps |
having(T left,
T operator,
T right) |
Example:
// SELECT year FROM book HAVING year > 2010
select("year", "id")
.from("book")
.having("year", ">", "2010")
.sql()
|
SelectHavingManySteps |
havingExists(Query query) |
Example:
// SELECT * FROM book HAVING EXISTS (SELECT * FROM author)
select("*")
.from("book")
.havingExists(select("*").from("authors"))
.sql()
|
assemblebuildPreparedStatement, sqlexcept, exceptAll, intersect, intersectAll, union, unionAlllimit, limitforKeyShare, forNoKeyUpdate, forShare, forUpdateoffset, offsetorderBy, orderBy, orderBy, orderBy<T> SelectHavingManySteps having(T left, T operator, T right)
// SELECT year FROM book HAVING year > 2010
select("year", "id")
.from("book")
.having("year", ">", "2010")
.sql()
T - String, Expression, Operator or Query objectleft - left operandoperator - operatorright - right operandSelectHavingManySteps having(Conditions conditions)
conditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc.
See the first example.
conditions is a group of conditions are joined by AND, AND NOT,
OR and OR NOT operators. These conditions are being a grouped condition,
and will be surrounded by parentheses.
See the second example.
// SELECT id FROM book HAVING id BETWEEN 1 AND 10
select("id")
.from("book")
.having(conditionBetween("id", "1", "10"))
.sql()
The second example:
// SELECT id, name FROM book HAVING (id BETWEEN 1 AND 10 AND name = 'Advanced SQL')
select("id", "name")
.from("book")
.having(
conditionBetween("id", "1", "10")
.and(asName("name"), operator("="), asString("Advanced SQL"))
)
.sql()
conditions - conditionQueryman.condition(Object, Object, Object)SelectHavingManySteps havingExists(Query query)
// SELECT * FROM book HAVING EXISTS (SELECT * FROM author)
select("*")
.from("book")
.havingExists(select("*").from("authors"))
.sql()
query - subquery