本文整理自网络,侵删。
学习 SQL 语句 - Select(8): 分组条件
代码文件:
--------------------------------------------------------------------------------
//分组条件可以是 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; 相关阅读 >>
Delphi adoquery连接数据库的查询、插入、删除、修改
Delphi idhttp post json 上传 php 接收
Delphi decodeutf8str解决系统自带utf8解码缺陷
Delphi google text to speech api
Delphi 缓冲文件流-tbufferedfilestream tfilestream 性能测试
Delphi xe listbox 行高根据内容高度进行调速
更多相关阅读请进入《Delphi》频道 >>