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

In This Topic
    GroupBy Property
    In This Topic
    Contains list of columns used in the GROUP BY clause of the current SelectStatement object.
    Syntax
    'Declaration
     
    Public ReadOnly Property GroupBy As SelectColumnCollection
    public SelectColumnCollection GroupBy {get;}

    Property Value

    A SelectColumnCollection that represents list of columns used in the GROUP BY clause.
    Example
    The following example demonstrates how to use the GroupBy 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());
    See Also