计算机二级vfp编程

来源:百度知道 编辑:UC知道 时间:2024/07/07 10:48:59
设职工表有职工号,姓名,性别,部门,工资等字段和足够的记录,其中前10个记录有姓"李"的职工记录,程序编写:职工表中前10个记录的职工姓名,但"李"者除外

USE 职工
DO WHILE recno()<=10

if left(姓名,2)="李"
skip
else
disp 姓名
skip
endif
enddo

select top 10 * from 职工表 where 姓名 not like "李%"

这样查出的是不包括 李姓职工的 前10条记录

楼上的是从前10条记录中去掉李姓职工

select * from(select top 10 * from 职工表) where 姓名 not like "李%"

select top 10 * from 职工表 where not 姓名 like "李%" order by 职工号 desc
解释:“top 10”一定得和 “order by ”一起用