主题:列之间的四则运算
我有一张数据表:其中表中有好几列数据。要想F列=A列+B列-C列;G列=F列*E列;查询或者窗口都可以。
要怎么弄?
open database g:\ÏúÊÛ¹ÜÀíϵͳ\cake.dbc
do while .not.eof()
declare @b;
declare @c;
declare @d;
declare @e;
declare @f;
declare @g;
declare @h;
set a=select ÏúÊÛÏêÇé.´æ»õ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé;
set @b=select ÏúÊÛÏêÇé.×òÌìÈë¯ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé;
set @c=select ÏúÊÛÏêÇé.½ñÌìÐÂ×ö FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @d=select ÏúÊÛÏêÇé.´¦ÀíÊý FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @e=select ÏúÊÛÏêÇé.ÍË»õ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @f=select ¼Û¸ñ.¼Û¸ñ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @g=@a+@b+@c-@d-@e
set @h=@f*@g
repl ÏúÊÛÏêÇé.ÏúÊÛÊýÁ¿ with @g
repl ÏúÊÛÏêÇé.ÏúÊÛ¶î with @h
skip 1
enddo
SELECT ÏúÊÛÏêÇé.ÈÕÆÚ, ÏúÊÛÏêÇé.±àÂë, ¼Û¸ñ.Æ·Ãû, ÏúÊÛÏêÇé.´æ»õ,;
ÏúÊÛÏêÇé.×òÌìÈë¯, ÏúÊÛÏêÇé.½ñÌìÐÂ×ö, ÏúÊÛÏêÇé.´¦ÀíÊý, ÏúÊÛÏêÇé.ÍË»õ,ÏúÊÛÏêÇé.ÏúÊÛÊýÁ¿,ÏúÊÛÏêÇé.ÏúÊÛ¶î;
FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé;
ON ¼Û¸ñ.±àÂë = ÏúÊÛÏêÇé.±àÂë;
GROUP BY ÏúÊÛÏêÇé.ÈÕÆÚ;
ORDER BY ÏúÊÛÏêÇé.ÈÕÆÚ
里面的乱码是中文,这里那些地方错了?
要怎么弄?
open database g:\ÏúÊÛ¹ÜÀíϵͳ\cake.dbc
do while .not.eof()
declare @b;
declare @c;
declare @d;
declare @e;
declare @f;
declare @g;
declare @h;
set a=select ÏúÊÛÏêÇé.´æ»õ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé;
set @b=select ÏúÊÛÏêÇé.×òÌìÈë¯ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé;
set @c=select ÏúÊÛÏêÇé.½ñÌìÐÂ×ö FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @d=select ÏúÊÛÏêÇé.´¦ÀíÊý FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @e=select ÏúÊÛÏêÇé.ÍË»õ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @f=select ¼Û¸ñ.¼Û¸ñ FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé
set @g=@a+@b+@c-@d-@e
set @h=@f*@g
repl ÏúÊÛÏêÇé.ÏúÊÛÊýÁ¿ with @g
repl ÏúÊÛÏêÇé.ÏúÊÛ¶î with @h
skip 1
enddo
SELECT ÏúÊÛÏêÇé.ÈÕÆÚ, ÏúÊÛÏêÇé.±àÂë, ¼Û¸ñ.Æ·Ãû, ÏúÊÛÏêÇé.´æ»õ,;
ÏúÊÛÏêÇé.×òÌìÈë¯, ÏúÊÛÏêÇé.½ñÌìÐÂ×ö, ÏúÊÛÏêÇé.´¦ÀíÊý, ÏúÊÛÏêÇé.ÍË»õ,ÏúÊÛÏêÇé.ÏúÊÛÊýÁ¿,ÏúÊÛÏêÇé.ÏúÊÛ¶î;
FROM cake!¼Û¸ñ INNER JOIN cake!ÏúÊÛÏêÇé;
ON ¼Û¸ñ.±àÂë = ÏúÊÛÏêÇé.±àÂë;
GROUP BY ÏúÊÛÏêÇé.ÈÕÆÚ;
ORDER BY ÏúÊÛÏêÇé.ÈÕÆÚ
里面的乱码是中文,这里那些地方错了?