D david2041 Unregistered / Unconfirmed GUEST, unregistred user! 2002-07-19 #1 例如我想将query连接的gzto.dbf里的年龄小于25的工资总和的值赋给一个变量, 与其它变量进行运算,应如何做? 谢谢
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2002-07-19 #2 var sum: Integer; begin with query do begin Close; SQL.Clear; SQL.Append('select sum(工资) from gzto'); SQL.Append('where 年龄<25'); Open; Sum:=Fields[0].Value end end;
var sum: Integer; begin with query do begin Close; SQL.Clear; SQL.Append('select sum(工资) from gzto'); SQL.Append('where 年龄<25'); Open; Sum:=Fields[0].Value end end;
H HunterTeam Unregistered / Unconfirmed GUEST, unregistred user! 2002-07-19 #3 query1.close; query1.sql.clear; query1.sql.add('select sum(工资) from 表 where 年龄<25'); Query1.open; 变量1:=变量2+query1.fields[0].asfloat;
query1.close; query1.sql.clear; query1.sql.add('select sum(工资) from 表 where 年龄<25'); Query1.open; 变量1:=变量2+query1.fields[0].asfloat;
U ugvanxk Unregistered / Unconfirmed GUEST, unregistred user! 2002-07-19 #4 query :select sum(工资) from tablename where 年龄<25 close; open; gz:= query1.fields[0].asfloat;
D dopro Unregistered / Unconfirmed GUEST, unregistred user! 2002-07-19 #5 select sum(工资) 工资 from gzto where 年龄<25 aa:=querey.fieldbyname('工资').asfloat
小 小乙 Unregistered / Unconfirmed GUEST, unregistred user! 2002-07-19 #6 定义变量: var: Zz:Float;//工资总值; Query里的SQL属性: Select 工资,sum(工资) From 工资表 Where 年龄<25 赋值: Query.open; Zz:=Query.FieldByName('sum_of_工资').AsFloat;
定义变量: var: Zz:Float;//工资总值; Query里的SQL属性: Select 工资,sum(工资) From 工资表 Where 年龄<25 赋值: Query.open; Zz:=Query.FieldByName('sum_of_工资').AsFloat;