Home about IT Motivation Course Sales Project About Me

Monday, March 29, 2010

Limit function at SQL Server

below Limit function for MySQL server:
select * from berita limit $posisi,$batas

and below for Ms SQL Server:

select top $batas * from wgrn_tbl where WGRN_ITMCD like '%$nama%' and WGRN_GRLNO not in ( select top $posisi WGRN_GRLNO from wgrn_tbl where WGRN_ITMCD like '%$nama%' order by WGRN_ITMCD,WGRN_RCVDT desc) order by WGRN_ITMCD,WGRN_RCVDT desc

Limit function used for e.g: at paging data for website

No comments: