Minying’s Blog

Just another WordPress.com weblog

資料庫中查前幾筆資料語法

發文作者 minying 於 五月 5, 2009

各資料庫中,查詢前幾筆資料語法有所差異。

DB2:

Select * From Table1 Order By Column1 Fetch First 10 Row Only

SQL Server:

Select Top 10 * From Table1 Order By Column1

MySQL:

Select * From Table1 Limit 10

Select * From Table Limit 10,5     查詢第11筆開始後5筆

Select * From Table Limit 10,-1     查詢第11筆開始至最後一筆

發表迴響

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

連結到 %s

 
Follow

Get every new post delivered to your Inbox.