关于排序问题
求助各位!表格见附件。政治、外语、化学、语文、数学、物理六个考试科目均有两个代码。我想把“mc”字段为政治的按“dm”升序排在一起(外语、化学、语文、数学、物理各科排序要求相同政治),并且总表中“mc”按政治、语文、数学、外语、化学、物理科目进行排序,请问该如何实现?谢谢!
czcj.zip
(1.27 KB)
set safety off sele * from czcj where mc="政治" order by fs desc into dbf ttable sele * from czcj where mc="语文" order by fs desc into dbf ttable2 sele * from czcj where mc="数学" order by fs desc into dbf ttable3 sele * from czcj where mc="外语" order by fs desc into dbf ttable4 sele * from czcj where mc="化学" order by fs desc into dbf ttable5 sele * from czcj where mc="物理" order by fs desc into dbf ttable6 SELECT ttable APPEND FROM ttable2 APPEND FROM ttable3 APPEND FROM ttable4 APPEND FROM ttable5 APPEND FROM ttable6 SELECT ttable brow
* 按DM排序 Select * From czcj Order By mc,dm Into Cursor dm browse * 按MC排序(政治、语文、数学、外语、化学、物理) * Vfp9 代码 Select * ,0 ID From czcj Into Cursor mc readwrite Replace All Id With Icase(Alltrim(mc)=='政治',1,Alltrim(mc)=='语文',2,Alltrim(mc)=='数学',3,Alltrim(mc)=='外语',4,Alltrim(mc)=='化学',5,6) Select * From mc Order By Id Into Cursor mc browse
* 按MC排序(政治、语文、数学、外语、化学、物理) * Vfp6 代码 Create Cursor mc (Xh C(3),Dm C(4),Mc C(10),Fs N(2),Id N(1)) Append From Czcj lcStr="政治、语文、数学、外语、化学、物理" =Alines(Akm,Strtran(lcStr,"、",Chr(13)+Chr(10))) For lnI=1 To Alen(Akm) Replace Id With lnI For Alltrim(Mc)==Akm[lnI] EndFor Select * From mc Order By Id Into Cursor mc browse