我知道的是从数据库中读取最前的十条数据的命令是
select top 10 id,topic from news where hidden=1 and c_id=1 order by id desc
那我想读取第11条至20条,那应该怎么在这段话上修改呢?
或者我想读取最后的十条,又该用什么参数呢?
參考答案:那我想读取第11条至20条:
select top 10 id,topic from news where id not in(select top 10 id from news where hidden=1 and c_id=1 order by id desc ) and hidden=1 and c_id=1 order by id desc
读取最前的十条:
select top 10 id,topic from news where hidden=1 and c_id=1 order by id
读取最后的十条:
select top 10 id,topic from news where hidden=1 and c_id=1 order by id desc