作者在 2021-03-04 11:53:18 发布以下内容
* 构造VFP中SQL命令字段表达式
CREATE CURSOR km (xk c(10))
INSERT INTO km VALUES ("语文")
INSERT INTO km VALUES ("数学")
INSERT INTO km VALUES ("英语")
INSERT INTO km VALUES ("物理")
INSERT INTO km VALUES ("化学")
INSERT INTO km VALUES ("思想品德")
INSERT INTO km VALUES ("历史")
lcStr = "zkzh, xm"
SCAN
lcStr = lcStr + ", " + 'CAST(SUM(IIF(ALLTRIM(xk) == "' + ALLTRIM(xk) + '", 分数 , 0)) AS N(3)) ' + ALLTRIM(xk)
ENDSCAN
?lcStr