delphi 学习 SQL 语句 - Select(8): 分组条件


本文整理自网络,侵删。

 学习 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 trayicon1如何把窗体关闭到系统托盘

Delphi执行cmd命令和bat文件

Delphi google text to speech api

Delphi 变体数组

Delphi 缓冲文件流-tbufferedfilestream tfilestream 性能测试

Delphi xe listbox 行高根据内容高度进行调速

Delphi 验证ip地址

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...