| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3664 人关注过本帖
标题:一组5000个学生考试等级,总共10个科目,查找出考试等级满足3A5B1C的学生名 ...
只看楼主 加入收藏
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
程序代码:
CREATE CURSOR TT (CJ C(9))
INSERT INTO TT(CJ) VALUES ("CDDAABAAA")
INSERT INTO TT(CJ) VALUES ("CDDACDBBC")
INSERT INTO TT(CJ) VALUES ("DDDBDDDDC")
INSERT INTO TT(CJ) VALUES ("BBDABBBBB")
INSERT INTO TT(CJ) VALUES ("CDDADDCDD")
INSERT INTO TT(CJ) VALUES ("CDDACDABA")
INSERT INTO TT(CJ) VALUES ("CDDBDDBDB")
INSERT INTO TT(CJ) VALUES ("CDDADCCCB")
INSERT INTO TT(CJ) VALUES ("BCDAAABBB")
INSERT INTO TT(CJ) VALUES ("DDDBDDDBC")
INSERT INTO TT(CJ) VALUES ("ABABBCBBA")
INSERT INTO TT(CJ) VALUES ("ABABACBBA")
SELECT * FROM TT WHERE OCCURS("D",CJ)=0 AND OCCURS("C",CJ)=1 AND OCCURS("B",CJ)<=5 INTO CURSOR JG
BROWSE

坚守VFP最后的阵地
2016-03-01 10:49
taifu945
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:80
帖 子:1545
专家分:3298
注 册:2012-7-6
收藏
得分:5 
以下是引用hguyy在2016-3-1 03:12:25的发言:

大神,我运行了一下程序,太感谢您了。我做的是一个切分的程序,要的是在这5000多条记录中查出满足最低条件是3A5B1C的考生,也就是查出9科成绩中不能有D,只能有1科C,最多5科B,其他为A的考生,不是单单查出一个3A5B1C的考生。
筛选出来结果是这样的:BBAABBBAA
BBAABBBBA
BBBABBABB
BBBAABCAA
BBBABBBBA
ABBAABBAA
BBAABBABB
ACBABBBBB
AAAAAAAAA
上面这些数据是从下面这些数据中筛选出来的:
CDDAABAAA
CDDACDBBC

根据你红字部分的条件,可以用这条命令筛选出结果(假设表文件名称是Czcj):
SELECT RECNO() 记录号,Cj FROM Czcj WHERE LEN(Cj)=9 AND ;
                                         !'D'$Cj AND ;
                                         AT('C',Cj,2)=0 AND ;
                                         AT('B',Cj,6)=0
命令的效果:
图片附件: 游客没有浏览图片的权限,请 登录注册


看看是否符合你的要求?

[此贴子已经被作者于2016-3-1 11:14编辑过]

2016-03-01 11:12
hguyy
Rank: 2
等 级:论坛游民
帖 子:56
专家分:20
注 册:2016-1-25
收藏
得分:0 
回复 11楼 sdta
谢谢
2016-03-01 11:12
hguyy
Rank: 2
等 级:论坛游民
帖 子:56
专家分:20
注 册:2016-1-25
收藏
得分:0 
回复 12楼 taifu945
谢谢
2016-03-01 11:13
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:191
帖 子:3147
专家分:8408
注 册:2015-3-25
收藏
得分:5 
以下是引用吹水佬在2016-3-1 08:08:18的发言:

(OCCURS("A", 等级)==3) AND (OCCURS("B", 等级)==5) AND (OCCURS("C", 等级)==1)

CREATE CURSOR Tmp(成绩 C(9))
INSERT INTO Tmp(成绩) VALUES("AAAAAAAAA") &&特殊值,另外加的
INSERT INTO Tmp(成绩) VALUES("CCAAAAAAA") &&特殊值,另外加的
INSERT INTO Tmp(成绩) VALUES("DCAAAAAAA") &&特殊值,另外加的
INSERT INTO Tmp(成绩) VALUES("BBBBBAAAA") &&特殊值,另外加的
INSERT INTO Tmp(成绩) VALUES("CBBBBBAAA") &&特殊值,另外加的
INSERT INTO Tmp(成绩) VALUES("CBBBBBBAA") &&特殊值,另外加的
INSERT INTO Tmp(成绩) VALUES("CDDAABAAA")
INSERT INTO Tmp(成绩) VALUES("CDDACDBBC")
INSERT INTO Tmp(成绩) VALUES("DDDBDDDDC")
INSERT INTO Tmp(成绩) VALUES("BBDABBBBB")
INSERT INTO Tmp(成绩) VALUES("CDDADDCDD")
INSERT INTO Tmp(成绩) VALUES("CDDACDABA")
INSERT INTO Tmp(成绩) VALUES("CDDBDDBDB")
INSERT INTO Tmp(成绩) VALUES("CDDADCCCB")
INSERT INTO Tmp(成绩) VALUES("BCDAAABBB")
INSERT INTO Tmp(成绩) VALUES("DDDBDDDBC")
INSERT INTO Tmp(成绩) VALUES("DBDBCDDDC")
INSERT INTO Tmp(成绩) VALUES("BDDACDBAB")
INSERT INTO Tmp(成绩) VALUES("DDCBDDDDC")
INSERT INTO Tmp(成绩) VALUES("BDDBDDCDD")
INSERT INTO Tmp(成绩) VALUES("CDDBDDCCB")
INSERT INTO Tmp(成绩) VALUES("BBAABBBAA")
INSERT INTO Tmp(成绩) VALUES("BDDABBAAB")
INSERT INTO Tmp(成绩) VALUES("DDDACCCDC")
INSERT INTO Tmp(成绩) VALUES("BBAABBBBA")
INSERT INTO Tmp(成绩) VALUES("BBBABBABB")
INSERT INTO Tmp(成绩) VALUES("DBDAABBAA")
INSERT INTO Tmp(成绩) VALUES("BBDBCBBBB")
INSERT INTO Tmp(成绩) VALUES("BBBAABCAA")
INSERT INTO Tmp(成绩) VALUES("CDDABBCBB")
INSERT INTO Tmp(成绩) VALUES("BBBABBBBA")
INSERT INTO Tmp(成绩) VALUES("BDCABBBBC")
INSERT INTO Tmp(成绩) VALUES("CDDACDBBA")
INSERT INTO Tmp(成绩) VALUES("DDDADDDAC")
INSERT INTO Tmp(成绩) VALUES("ABBAABBAA")
INSERT INTO Tmp(成绩) VALUES("BCAABBBCB")
INSERT INTO Tmp(成绩) VALUES("BBAABBABB")

SELECT * FROM Tmp WHERE OCCURS("D",UPPER(成绩))=0 AND OCCURS("C",UPPER(成绩))<=1 AND OCCURS("B",UPPER(成绩))<=5 INTO CURSOR Tmp_cj
brow

2016-03-01 11:57
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
以下是引用hguyy在2016-3-1 03:12:25的发言:

大神,我运行了一下程序,太感谢您了。我做的是一个切分的程序,要的是在这5000多条记录中查出满足最低条件是3A5B1C的考生,也就是查出9科成绩中不能有D,只能有1科C,最多5科B,其他为A的考生,不是单单查出一个3A5B1C的考生。
筛选出来结果是这样的:BBAABBBAA
BBAABBBBA
BBBABBABB
BBBAABCAA
BBBABBBBA
ABBAABBAA
BBAABBABB
ACBABBBBB
AAAAAAAAA
上面这些数据是从下面这些数据中筛选出来的:
CDDAABAAA
CDDACDBBC
DDDBDDDDC
BBDABBBBB
CDDADDCDD
CDDACDABA
CDDBDDBDB
CDDADCCCB
BCDAAABBB
DDDBDDDBC
DBDBCDDDC
BDDACDBAB
DDCBDDDDC
BDDBDDCDD
CDDBDDCCB
BBAABBBAA
BDDABBAAB
DDDACCCDC
BBAABBBBA
BBBABBABB
DBDAABBAA
BBDBCBBBB
BBBAABCAA
CDDABBCBB
BBBABBBBA
BDCABBBBC
CDDACDBBA
DDDADDDAC
ABBAABBAA
BCAABBBCB
BBAABBABB
BDCACCCBB
BDBACCCCB
ACBABBBBB
BDDADDBDC
BDDACDBDB
BDDBDDDDC
AAAAAAAAA
BCBABBBBB
BCBADBCCC
ABCABBBBA
ABAAABAAA
ADBADDBBB
BBAACBBBA
BDCADCABA
ADDADDBBC
ADCADDBBB
ABAAAAAAA
BBBABBABA
ACBABBBBA
ADAABBBBA
BDDADDDCC
BDDACCBBB
DDDBDDDDD
ACAABBAAA
BCCABBBBB
BDDBDDDDD
BDBACABCB
CBDBBBBAA
CDDDDDDDD
CCCBCBBBB
BCBBBAABB
DDDBDDDDD
BDDCDDDCD
DDDCDDDDD
CDDCDBDBB
DDDDDDDDD
DCDCDDDCB
DDDBDBCCB
DBDBDBDCB
DDDDDDDDD
DDDDDDDDD
CDDCDDDDD
CCDBDBBBC
BCDACBABB
DDDDDDDDB
CBDBBABBB
CDDBDDD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DDDDDD
DDDDDDDDD
DDDDDDD
DDDDDDDDD
DD
DDDCDDDDD
BCBABBBBB
ABCABBBBA
ABAAABAAA
BBAACBBBA
ABAAAAAAA
BBBABBABA
ACBABBBBA
ACAABBAAA
BCBBBAABB
ACAABBBBC

3A6B是否符合条件

坚守VFP最后的阵地
2019-06-29 16:45
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
条件
D = 0
C <= 1
A >= 3
B >= 5

坚守VFP最后的阵地
2021-04-04 18:35
快速回复:一组5000个学生考试等级,总共10个科目,查找出考试等级满足3A5B1C的学 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041674 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved