以下是引用wjp456789在2012-10-18 12:59:42的发言:
我来献丑了:
代码如下: CREATE TABLE taba(F1 N(3))
FOR I=1 TO 20
INSERT INTO taba VALUES(RAND()*200-100)
ENDFOR
BROWSE
SELECT SUM(IIF(f1>0,f1,0)) as 正数之和,SUM(IIF(f1<0,f1,0)) as 负数之和 FROM taba INTO CURSOR temp
BROWSE
如果都要临时表。就用 CREATE CURSOR taba(F1 N(3))
FOR I=1 TO 20
INSERT INTO taba VALUES(RAND()*200-100)
ENDFOR
BROWSE
SELECT SUM(IIF(f1>0,f1,0)) as 正数之和,SUM(IIF(f1<0,f1,0)) as 负数之和 FROM taba INTO CURSOR temp
BROWSE
谢谢兄弟,这种题目编程很简单,我说的是仅用一句SELECT-SQL语句。