dotConnect for PostgreSQL Documentation
Devart.Common Namespace / SelectStatement Class / Having Property
Example

Having Property
Gets or sets HAVING clause of the statement.
Syntax
'Declaration
 
Public Overridable Property Having As String
 

Property Value

The HAVING clause of the statement.
Remarks
To quickly add new condition to the clause use the AddHavingCondition method.
Example
The following example demonstrates how to use the Having property.
PgSqlSelectStatement stmt = new PgSqlSelectStatement();
SelectColumn jobName = new SelectColumn("JOB");
stmt.Columns.Add(jobName);
stmt.Columns.Add(new SelectColumn("AVG(SAL)"));
stmt.Tables.Add(new SelectTable("emp"));

stmt.GroupBy.Add(jobName);
stmt.Having = "AVG(SAL) > 1000";

//select JOB,AVG(SAL) from emp group by JOB having AVG(SAL) > 1000
PgSqlCommand command = new PgSqlCommand(stmt.ToString());
Dim stmt As New PgSqlSelectStatement
Dim jobName As New SelectColumn("JOB")
stmt.Columns.Add(jobName)
stmt.Columns.Add(New SelectColumn("AVG(SAL)"))
stmt.Tables.Add(New SelectTable("emp"))

stmt.GroupBy.Add(jobName)
stmt.Having = "AVG(SAL) > 1000"

'select JOB,AVG(SAL) from emp group by JOB having AVG(SAL) > 1000
Dim command As New PgSqlCommand(stmt.ToString)
See Also