只需一步,快速开始
1970-1-1 08:00| 发布者: cg1『文章』| 查看: 5140| 评论: 1
原文:http://access911.net/72FAB31E10DCEEF3.htm
问题:
有这样一个表:
ID RID001 001002 001003 001004 004005 004006 004007 007008 007009 009010 010
希望取得每组RID相同的前2条记录,即:ID RID001 001002 001004 004005 004007 007008 007009 009010 010
能否用尽可能简单的语句实现?请各位指点
回答:select * from t as awhere id in(select top 2 id from t where rid=a.rid order by id)
查看全部评论(1)
评论
|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )
GMT+8, 2025-2-20 04:46 , Processed in 0.064324 second(s), 16 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.