JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Servlet/JSP 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Re:大家是否可以提供 寫分頁的方式~ [Re:frank]
JackTasy





發文: 8
積分: 0
於 2004-08-15 00:08 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
frank wrote:
MySQL Manual 14.1.8 Subquery Syntax
1
2
3
Starting with MySQL 4.1, all subquery forms and operations 
that the SQL standard requires are supported, 
as well as a few features that are MySQL-specific.



真是個好消息呀,不過剛上官網看了一下 4.1 Beta release (use this for new development) ,目前還非 Production Version,在等一下下....
謝啦!


reply to postreply to post
作者 Re:大家是否可以提供 寫分頁的方式~ [Re:stallone_hwang]
xsmall

睜大雙眼~看透這個世界



發文: 78
積分: 0
於 2006-10-17 11:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
stallone_hwang wrote:
Dear ALL:
個人使用的是MS SQL2K DB,使用下列方式做分頁(12000筆巳上資料)

1
2
curpage=Integer.parseInt(request.getParameter("page"));//顯示的頁
ResultSet rs=cn.rsexecuteQuery("select top "+page_record+" * from tablename where id not in (select top "+(curpage*page_record)+" id from tablename order by id desc) order by id desc");


ps.這是利用MS SQL的Top,一次找還幾筆,loadind 在DB Server。目前使用上效果還不錯..
ps2.可否有更好的作法,例如可連各種DB,這樣就可寫一class大家用了..


那如果以這個sql命令,改由limit的方式,要怎麼改比較好?


reply to postreply to post
不適合喝咖啡的我~卻愛上它那特有的淡淡香氣....Orz
好在還有茶能代替.....品茗咧~
作者 Re:大家是否可以提供 寫分頁的方式~ [Re:frank]
andydn





發文: 80
積分: 0
於 2008-04-23 14:36 user profilesend a private message to usersend email to andydnreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我平時使用方法

oracle => 使用 rownum

mysql => 使用 limit 10, 10

mssql => SELECT TOP 10 id, name FROM tableA WHERE id NOT IN(SELECT TOP 10 id FROM tableA)

但是如果mysql 的id 不是primary key 那 not in 做出來的分頁, 就亂掉了
想請教大家會用什麼方法解Smile ?


reply to postreply to post
奇蹟總在相信之後
go to first page go to previous page  1   2  go to next page go to last page
» JWorld@TW »  Servlet/JSP 討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8