有关visual fox用什么命令来查到这类结果?(例如:查得分返回学生姓名)

来源:百度知道 编辑:UC知道 时间:2024/05/05 11:12:06
学号 姓名 语文 数学 英语
A001 小明 80 90 100
A002 中明 90 100 80
A003 大明 100 80 90

如上表
1.怎么查询某科的最高分的学生名字(如查询英语则返回小明,查询数学则返回中明………)?

2.怎么查询总分最高的学生并返回其姓名?

回答好我继续加分!

我觉得你可以像这样做.写一个程序.假设你的表为students.dbf.则你的程序可以这样写:
procedure search
PARAMETER object &&object为你所要查寻的科目
close all
local temp,result,name&&temp用来暂保存分数.result 存储分数的最大值,name用来返回名字.
use students
result=students.object
temp=result
name=students.姓名
scan
temp=students.object
if temp>result
result=temp
name=students.姓名
endif
endscan
messagebox(object+"科的最高分数为”+chr(13)+name+"同学;的"+inttostr(result),64,"提示")
endproce