如何统计出某一字段内容的个数
编号:QA003456
建立日期: 2000年10月24日 最后修改日期:2000年10月24日
所属类别:
zhjq:
操作系统: win98
编程工具: delphi5
问题: 如何统计出某一字段内容的个数?例如“数学成绩”为一个成绩表的字段,如何统计出“数学成绩”中“优秀”的 个数?“优良?的个数?(当然,同时还要统计其他字段)。
水平: 刚入门
回答:
Delphi可以在TQuery控件中使用SQL语句得到统计结果。如:
with CustomerQuery do begin
Close; { close the query if it's active }
with SQL do begin
Clear; { delete the current SQL statement, if any }
Add('SELECT Count(*) FROM Score?; { add first line of SQL... }
Add('WHERE Math >85'); { ... and second line }
end;
Open; { activate the query }
end;
相关问题:
QA002999 "SQL语句的结果如何获取"
此问题由李海回答。
| |
|
|
| |
|
|