VFP中select SQL中如何使用deleted()?
百思不得其解:
SELECT Gonghuo.htbh, Yw.xmmc, Kehu.khmc, Gonghuo.sxrq, Gonghuo.htje,;
Gonghuo.sjje, Gonghuo.htghrq, Gonghuo.sjghrq, Rsstrs.xm, Gonghuo.fkff,;
Gonghuo.khbh, Gonghuo.xmbh, Yw.xiaosbh, Gonghuo.zhibdq, ;
IIF(DELETED(),.T.,.F.) as scbj;
FROM wanglai!gonghuo LEFT OUTER JOIN wanglai!kehu ;
ON Gonghuo.khbh = Kehu.khbh ;
LEFT OUTER JOIN wanglai!yw ;
ON Gonghuo.xmbh = Yw.xmbh ;
LEFT OUTER JOIN wanglai!rsstrs ;
ON Yw.xiaosbh = Rsstrs.bh ;
WHERE &tj;
ORDER BY Gonghuo.sxrq, Yw.xmmc ;
INTO CURSOR gh_linshi
在生成的临时表中,凡gonghuo中带删除标记的记录的scbj为.T.,未带删除标记的记录scbj为.F.
但上述语句执行后,所有语句的scbj均为.F.
我将deleted()改为deleted('gonghuo'),这样一来,如果gonghuo中有一条记录带删除标记,则临时表
中所有记录的scbj均为.T.,否则均为.F.
请高手帮忙看一下,谢谢。
[解决办法]
Select *,Iif(Deleted(),.T.,.F.) As scbj Into Cursor gonghuo1 From wanglai!gonghuoSelect Gonghuo1.htbh, Yw.xmmc, Kehu.khmc, Gonghuo1.sxrq, Gonghuo1.htje,; Gonghuo1.sjje, Gonghuo1.htghrq, Gonghuo1.sjghrq, Rsstrs.xm, Gonghuo1.fkff,; Gonghuo1.khbh, Gonghuo1.xmbh, Yw.xiaosbh, Gonghuo1.zhibdq,Gonghuo1.scbj ; From gonghuo1 Left Outer Join wanglai!kehu ; On Gonghuo1.khbh = Kehu.khbh ; Left Outer Join wanglai!yw ; On Gonghuo1.xmbh = Yw.xmbh ; Left Outer Join wanglai!rsstrs ; On Yw.xiaosbh = Rsstrs.bh ; Where &tj; Order By Gonghuo1.sxrq, Yw.xmmc ; Into Cursor gh_linshi