* 建立测试数据 Kmk,Code 为字符串
CREATE CURSOR kmk(Code C(3),Name C(40))
INSERT INTO kmk(Code,Name) VALUES ('100','教育基础知识(高中、初中)')
INSERT INTO kmk(Code,Name) VALUES ('101','语文(高中、初中)')
INSERT INTO kmk(Code,Name) VALUES ('102','数学(高中、初中)')
INSERT INTO kmk(Code,Name) VALUES ('103','英语(高中、初中)')
INSERT INTO kmk(Code,Name) VALUES ('200','教育基础知识(小学)')
INSERT INTO kmk(Code,Name) VALUES ('201','语文(小学)')
INSERT INTO kmk(Code,Name) VALUES ('202','数学(小学)')
INSERT INTO kmk(Code,Name) VALUES ('203','英语(小学)')
*BROWSE
**合并
select Code ,Name from Kmk WHERE INLIST(Code,'100','200','300') INTO CURSOR tb_ls1
select Code ,Name from Kmk WHERE NOT INLIST(Code,'100','200','300') INTO CURSOR tb_ls2
rc1 = RECCOUNT("tb_ls1")
rc2 = RECCOUNT("tb_ls2")
IF rc1>rc2
SELECT IIF(ISNULL(k1.km1),'',k1.km1) as km1,IIF(ISNULL(k1.km1mc),'',k1.km1mc) as km1mc,IIF(ISNULL(k2.km2),'',k2.km2) as km2,IIF(ISNULL(k2.km2mc),'',k2.km2mc) as km2mc;
FROM (select Code as km1,Name as km1mc,space(3) as km2,space(40) as km2mc,recn() as rn from tb_ls1)k1 ;
left join (select space(3) as km1,space(40) as km1mc,Code as km2,Name as km2mc,recn() as rn from tb_ls2)k2 on k1.rn=k2.rn ;
into CURSOR ls1
ELSE
SELECT IIF(ISNULL(k1.km1),'',k1.km1) as km1,IIF(ISNULL(k1.km1mc),'',k1.km1mc) as km1mc,IIF(ISNULL(k2.km2),'',k2.km2) as km2,IIF(ISNULL(k2.km2mc),'',k2.km2mc) as km2mc;
FROM (select Code as km1,Name as km1mc,space(3) as km2,space(40) as km2mc,recn() as rn from tb_ls1)k1 ;
right join (select space(3) as km1,space(40) as km1mc,Code as km2,Name as km2mc,recn() as rn from tb_ls2)k2 on k1.rn=k2.rn ;
into CURSOR ls1
ENDIF
BROWSE
图片附件: 游客没有浏览图片的权限,请
登录 或
注册