Tuesday, January 8, 2008

Sử dụng hàm LIMIT của Oracle

// mysql
select col from tbl limit 20;

// Oracle
select col from tbl where rownum<=20;

// Microsoft SQL
select top 20 col from tbl;

VD: Oracle

SELECT * FROM ( SELECT rowid as ID,field1,field2,field3 FROM mytable ) WHERE id BETWEEN 20 AND 40

Vd: MySQL

SELECT * FROM employee LIMIT 20,10

1 comment:

Anonymous said...

well.that great.thanks.it can solve my problem.
DrNhut