代码文件:
//分组条件可以是 Where
procedure TForm1.Button1Click(Sender: TObject);
begin
  with ADODataSet1 do begin
    Close;
    CommandText := 'SELECT Continent, AVG(Area) AS 平均面积 ' +
                   'FROM country WHERE Continent="South America" GROUP BY Continent';
    Open;
  end;
end;

//也可以是 Having
procedure TForm1.Button2Click(Sender: TObject);
begin
  with ADODataSet1 do begin
    Close;
    CommandText := 'SELECT Continent, AVG(Area) AS 平均面积 ' +
                   'FROM country GROUP BY Continent HAVING Continent<>"South America"';
    Open;
  end;
end;

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2022-01-15
  • 2022-01-01
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2021-06-04
  • 2022-12-23
  • 2022-01-15
  • 2021-08-28
  • 2021-12-31
  • 2021-11-20
  • 2021-10-28
相关资源
相似解决方案