罗马景点 英文名称:关于sql select的问题,请教高手!

来源:百度文库 编辑:高校问答 时间:2024/04/28 07:01:50
我的表中有 3个字段,分别是id,elite, eid。我现在想要实现一个功能,如果表中有纪录elite=ture的就置顶先选出,一共需要列12条纪录,elite=ture的纪录有3种情况需要考虑:0条纪录、只有几条纪录、大于12条纪录,如果上面列出的不够12条,剩下的就从eid=‘3’选出。
其中置顶的和补充的两部分都要按照id的倒序列出。

rs.open "select *from table1 where elite=true order by [id] decs ;",conn,1,3
if rs.recordcount>12 then
dim i
i=1
do while i<=12
i=i+1
'添加操作语句
rs.movenext
loop
else
do while i<=3 and not rs.eof
i=i+1
'你的操作语句
rs.movenext
loop
end if