SqlSelectStatement stmt = new SqlSelectStatement(); 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 SqlCommand command = new SqlCommand(stmt.ToString());
Dim stmt As New SqlSelectStatement 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 SqlCommand(stmt.ToString)
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