Jcat
宠辱不惊,闲看庭前花开花落~~
posts - 173,comments - 67,trackbacks - 0
--same function different database: find the first 5 rows
 
select top 5 * from some_table                                         -- sql server

select * from some_table rownum >=1 and rownum<=5   -- oracle (begin at 1)
 
select * from some_table limit 0, 5                                    -- mysql (begin at 0)
 
select * from some_table limit 5 offset 0                            -- postgreSQL (begin at 0)


--however, if you want to implement between 10 to 20 in SQL SERVER, you have to use following trick
select top 10 * from
(select top 20 * from some_table) t
order by t.primary_key desc
posted on 2006-12-13 14:34 Jcat 阅读(176) 评论(0)  编辑  收藏 所属分类: Database

只有注册用户登录后才能发表评论。


网站导航: