以下是引用TZTJ在2015-10-16 11:37:33的发言:
我有这样设想,从一个表查询出所需数据,再按年级查询分成两表再合成一个表,即
select 学号1,姓名1 from kc1 where 考场=i AND 年级=a(1) ORDER BY 考号 into cursor kach1
select 学号2,姓名2 from kc1 where 考场=i AND 年级=a(2) ORDER BY 考号 into cursor kach2
但怎样合成的表字段是学号1,姓名1,学号2,姓名2,
select RECNO() as id, 学号1,姓名1 from kc1 where
考场=i AND 年级=a(1) ORDER BY 考号
into cursor kach1
select RECNO() as id, 学号2,姓名2 from kc1 where
考场=i AND 年级=a(2) ORDER BY 考号
into cursor kach2
SELECT kach1.学号1 as 学号1,;
kach1.姓名1 as 姓名1,;
kach2.学号2 as 学号2,;
kach2.姓名2 as 姓名2;
FROM kach1, kach2;
WHERE kach1.id==kach2.id