根据Tiger5392版主的思路,我模仿了一下:求A+B+C=B+J+G=D+E=F+E+G+H=J+K,同理,从1~10不能重复,结果应是:3,8,4,10,5,2,1,7,6,9,但如下程序实现不了,求助!
CREATE CURSOR tmp (n n(1))
FOR i=1 TO 10
INSERT INTO tmp VALUES (i)
ENDFOR
SELECT a.n a,b.n b,c.n c,d.n d,e.n e,f.n f,g.n g,h.n h,j.n j,k.n k;
FROM tmp a,tmp b,tmp c,tmp d,tmp e,tmp f,tmp g,tmp h,tmp j,tmp k;
WHERE !INLIST(a.n,b.n,c.n,d.n,e.n,f.n,g.n,h.n,j.n,k.n) and;
!INLIST(b.n,c.n,d.n,e.n,f.n,g.n,h.n,j.n,k.n) and;
!INLIST(c.n,d.n,e.n,f.n,g.n,h.n,j.n,k.n) and;
!INLIST(d.n,e.n,f.n,g.n,h.n,j.n,k.n) and;
!INLIST(e.n,f.n,g.n,h.n,j.n,k.n) and;
!INLIST(f.n,g.n,h.n,j.n,k.n) and;
!INLIST(g.n,h.n,j.n,k.n) and;
!INLIST(h.n,j.n,k.n) and;
!INLIST(j.n,k.n) and;
a.n+b.n+c.n=b.n+j.n+g.n AND b.n+j.n+g.n=d.n+e.n AND d.n+e.n=f.n+e.n+g.n+h.n AND d.n+e.n=j.n+k.n;
INTO CURSOR tm
SELECT tm
LIST to xx.txt