如何做这个统计?(50分)

  • 主题发起人 主题发起人 wtiebo
  • 开始时间 开始时间
W

wtiebo

Unregistered / Unconfirmed
GUEST, unregistred user!
我要统计数据库中的一个字段,并返回其值,然后将值赋给另一
字段.请问该怎么做? 我不大懂SQL! 谢谢!
 
var
s:integer
begin
query1.sql.add('select sum(field1) as sum1 from table1');
Query1.open;
s:=Query1.FieldByName('sum1').asinteger;
Query2.Sql.add(format('update set field2=%d from table1 where 条件',));
Query2.Sql.ExecSql;
end;

可能还有点错, 不过大致如此。
 
下面SQL供参考
UPDATE employee SET salary = salary + salary * 0.10
WHERE hire_date <= '08/01/91' AND job_grade = 5;
 
就是类似 UPDATE SET XXX SELECT 之类的东西?
 
Sorry, I haven't come here for a long time now. Thank all of you
to help me!
 
Sorry, I haven't come here for a long time now. Thank all of you
to help me!
 
后退
顶部