W wtiebo Unregistered / Unconfirmed GUEST, unregistred user! 1999-03-27 #1 我要统计数据库中的一个字段,并返回其值,然后将值赋给另一 字段.请问该怎么做? 我不大懂SQL! 谢谢!
L liwei Unregistered / Unconfirmed GUEST, unregistred user! 1999-03-28 #2 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; 可能还有点错, 不过大致如此。
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; 可能还有点错, 不过大致如此。
王 王淳霞 Unregistered / Unconfirmed GUEST, unregistred user! 1999-03-28 #3 下面SQL供参考 UPDATE employee SET salary = salary + salary * 0.10 WHERE hire_date <= '08/01/91' AND job_grade = 5;
下面SQL供参考 UPDATE employee SET salary = salary + salary * 0.10 WHERE hire_date <= '08/01/91' AND job_grade = 5;
C CJ Unregistered / Unconfirmed GUEST, unregistred user! 1999-03-28 #4 就是类似 UPDATE SET XXX SELECT 之类的东西?
W wtiebo Unregistered / Unconfirmed GUEST, unregistred user! 1999-04-18 #5 Sorry, I haven't come here for a long time now. Thank all of you to help me!
W wtiebo Unregistered / Unconfirmed GUEST, unregistred user! 1999-04-18 #6 Sorry, I haven't come here for a long time now. Thank all of you to help me!