程序代码:
CREATE CURSOR T1 (NO N(8),NAME C(20),VALUE N(8),EXP1 N(8))
INSERT INTO T1 (NO,NAME,VALUE) VALUES (1,[上衣],100)
INSERT INTO T1 (NO,NAME,VALUE) VALUES (2,[上衣,标签],200)
INSERT INTO T1 (NO,NAME,VALUE) VALUES (3,[书,皮带,标签],300)
INSERT INTO T1 (NO,NAME,VALUE) VALUES (4,[皮带,提单],400)
INSERT INTO T1 (NO,NAME,VALUE) VALUES (5,[提单,标签,上衣],500)
INSERT INTO T1 (NO,NAME,VALUE) VALUES (6,[小册子],600)
CREATE CURSOR T2 (ORD N(8),NAME C(4),PRICE N(8))
INSERT INTO T2 VALUES (1,[上衣],10)
INSERT INTO T2 VALUES (2,[标签],20)
INSERT INTO T2 VALUES (3,[皮带],30)
INSERT INTO T2 VALUES (4,[书],40)
INSERT INTO T2 VALUES (5,[提单],50)
SELECT T1
SCAN
LCSTR=[]
FOR I=1 TO ALINES(A,ALLTRIM(NAME),[,])
LCSTR=LCSTR+'"'+A(I)+'"'+IIF(I<ALINES(A,ALLTRIM(NAME),[,]),[,],[])
ENDFOR
SELECT MIN(PRICE) FROM T2 WHERE INLIST(NAME,&LCSTR) INTO ARRAY ATEMP
REPLACE EXP1 WITH NVL(ATEMP(1)*T1.VALUE,0)
ENDSCAN
BLANK FIELDS EXP1 FOR EXP1=0 IN T1
BROWSE
该贴原作者:lygcw9602