长草颜调皮表情包图片:access中,有个表stn,有id,name,addr,birthdy.

来源:百度文库 编辑:高校问答 时间:2024/04/30 14:27:53
access中,有个表stn,有id,name,addr,birthdy.现有1万条,要用一条select语句查出birthday大于1982-10-10的所有学生中的第5到15条

这样
SELECT top 10 *
FROM stn
where datediff('d',[birthdy],'1982-10-10')<0 and id_ not in (select top 5 id_ from stn where datediff('d',[birthdy],'1982-10-10')<0 order by birthdy)
order by birthdy

这样出来的结果出来会有重复的,所以结果集数据会大于10条,你可以再distinct一下就好了