Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

°ïÐÄÓÅ»¯Ò»ÏÂsql - MS-SQL Server / »ù´¡Àà

declare @sql=N'SELECT TOP '+cast(@pageSize as varchar(50))+' * from (SELECT TOP '
+cast(@pageSize*@currentpage as varchar(50))+' * from [InMail] A ORDER BY A.id DESC) B ORDER BY B.id ASC'
set @sql='SELECT from ('+@sql+') C ORDER BY C.id DESC'

ÏÈÊÇ·ÖÃæ¡£µ«ÊǺóÃæÓÖ³öÀ´ÁËÅÅÐò²»ÕýÈ·ÁË¡£
Èç

1
2
3
4
5
6
7
8
9

ÏÂÃæÊÇ×îеġ£ÒªÏÔÊÇÔÚ×îÉÏÃæ
Èç¹ûpageSize=2 currentPage=2
ÔòÒªÇóÈ¡³ö
7
6
----------
pageSize=2 currentPage=3
5
4


²»ºÃÒâ˼£¬±êÌâ´ò´íÁË¡£


ÒýÓÃ
SQL code
--> Éú³É²âÊÔÊý¾Ý±í: [InMail]
IF OBJECT_ID('[InMail]') IS NOT NULL
DROP TABLE [InMail]
GO
CREATE TABLE [InMail] ([ID] [int])
INSERT INTO [InMail]
SELECT '1' UNION ALL
SELECT '2' UNION ALL¡­¡­

ÓÐûÓпÉÒÔÓÅ»¯Ò»Ïµģ¿

ÎÒ¿¿£¬ÏÂÃæµÄʲôÌù×ÓŶ¡£°ÑÎÒÎÊÌⶼ¸ø¸ÇÏÂÈ¥ÁË¡£

ÒýÓÃ
ÎÒ¿¿£¬ÏÂÃæµÄʲôÌù×ÓŶ¡£°ÑÎÒÎÊÌⶼ¸ø¸ÇÏÂÈ¥ÁË¡£


ÄãÊÇʲô°æ±¾µÄÊý¾Ý¿â£¿

ÒýÓÃ
ÒýÓà 4 Â¥ jinfengyiye µÄ»Ø¸´:
ÎÒ¿¿£¬ÏÂÃæµÄʲôÌù×ÓŶ¡£°ÑÎÒÎÊÌⶼ¸ø¸ÇÏÂÈ¥ÁË¡£


ÄãÊÇʲô°æ±¾µÄÊý¾Ý¿â£¿

Õâ¸ö²»ÊÇ£¬ÎÒÊÇ˵csdnÀïµÄÌù×Ó£¬ÄÇЩXXÌù£¬°ÑÎÒµÄÌù×Ó¸ÇÏÂÈ¥ÁË¡£

SQL code



Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighl


Ïà¹ØÎÊ´ð£º

csvÎļþת»»³Ésqlµ¼Èëµ½Êý¾Ý¿â£¬Ã»ÓÐÊý¾ÝΪºÎ£¿

Ö´ÐеÄ˳Ðò£º
1£©Îļþä¯ÀÀ¿ò£¨Ñ¡ÔñÎļþʹÓã©
Ñ¡ÔñºÃÎļþºó
µã»÷Ò»¸öµ¼Èë°´Å¥µÄʱºò £¬°ÑÉÏÃæÉÏ´«¿òÀïµÄcsvÎļþÒÔÒ»¸öIDΪÎļþÃû£¬ÉÏ´«µ½**/**Îļþ¼ÐÏÂ
2£©¶ÁÈ¡Õâ¸öÎļþ¼ÐϵÄcsvµÄÎļþ£¬×ª»»³Ésql
3 ......

Çë½ÌsqlÓï¾ä¡£ - Oracle / ¿ª·¢

ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
  ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......

ÇóÒ»SQL - MS-SQL Server / »ù´¡Àà

tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......

sql ÎÊÌâ - MS-SQL Server / »ù´¡Àà

ÐèÇóÈçÏ£º
ѧԺ academy£¨aid,aname£©
°à¼¶ class£¨cid,cname,aid£©
ѧÉú stu(sid,sname,aid,cid)
סËÞÇø region(rid,rname)
ËÞÉáÂ¥ build(bid,rid,bnote) bnoteÊÇ¡®ÄС¯/¡®Å®¡¯
ËÞÉá dorm(did,rid,bid£¬bedn ......

Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿ - MS-SQL Server / »ù´¡Àà

Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿
ÖÁÉٵø½¼Óµ½sqlserverÉÏ

¾ßÌåÔõôŪ°¡ ÎҵıÏÒµÉè¼ÆµÄÊý¾Ý¿âÊÇ´ÓÍøÉÏdownÏÂÀ´µÄ£¿£¿

Ä㻹²»ÈçÖ±½ÓÓÃsqlserverÄØ

º¯Êý¡¢´æ´¢¹ý³Ì¶¼µÃ¸ÄÁË¡£

sqlserverûÔõôÓùý¡£Ò²Ã»Óа²× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ