dotConnect for DB2 Documentation
Devart.Common Namespace / SelectStatement Class / AddHavingCondition Method
A new condition to add.
Example

In This Topic
    AddHavingCondition Method
    In This Topic
    Adds new condition to HAVING clause of the statement, represented by the Having property.
    Syntax
    'Declaration
     
    Public Sub AddHavingCondition( _
       ByVal condition As String _
    ) 
    public void AddHavingCondition( 
       string condition
    )

    Parameters

    condition
    A new condition to add.
    Remarks
    If the Having property is not empty, the new condition is concatenated using AND keyword.
    Example
    The following example demonstrates how to use the AddHavingCondition method.
    DB2SelectStatement stmt = new DB2SelectStatement();
    stmt.Columns.Add(new SelectColumn("EMP"));
    stmt.Columns.Add(new SelectColumn("SAL"));
    stmt.Tables.Add(new SelectTable("emp"));
    
    stmt.AddHavingCondition("SAL > 1000");
    
    //select JOB,SAL from emp having SAL > 1000
    DB2Command command = new DB2Command(stmt.ToString());
    Dim stmt As New DB2SelectStatement
    stmt.Columns.Add(New SelectColumn("EMP"))
    stmt.Columns.Add(New SelectColumn("SAL"))
    stmt.Tables.Add(New SelectTable("emp"))
    stmt.AddHavingCondition("SAL > 1000")
    
    'select JOB,SAL from emp having SAL > 1000
    Dim command As New DB2Command(stmt.ToString)
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also