恖椡専嶕偼偰側
邮薏贁艂饡\帵偟偰偄傑偡C斉偼偙偪傜
i-mobile

偡偛偔弶曕揑側幙栤偩偲巚偆偺偱偡偑殏獋艂膫珎軅箓瘛
SQL偱SELECT偡傞嵺媺授喊霓偵1񎎙4偺傛偆偵弴斣傪蹲褌蓲菈羵穫閸\暥偭偰偳偆偡傞偺偱偟偨偐丠
LIMIT傪巊偊偽醾慰澳寢壥偺5斣栚偵奩摉偡傞诤澳迋饝I戰昞帵偱偒傑偡偑粋虌t偱SELECT偝傟偨偆偪偺奩摉诤澳迋獕綌詵趥葌虃﹤獟m傝偨偄偺偱偡

仠幙栤幰: kyoko55
仠睹恨:狠诉
✍钒馨霓:SELECT SQL 诤澳
仜 忬懺 :廔椆
劋 夞摎悢 : 5/5審

仱嵟怴偺夞摎傊

1 仠 kuromaku0103
仠20芜草

http://homepage2.nifty.com/sak/w_sak3/doc/sysbrd/sq_kj04_2.htm

SQL 栤偄崌傢偣 - 蕉装暃栤偄崌傢偣ursorow_numberverith - SAK Streets

URL偺ow_number艂祩鍌DB2偲Oracle偱偼摦嶌妋擣偟偰傑偡B偵傛偭偰偼晃甙膫祩膫葌鄠虃鄠爞羵絺﹤鄠祩陚軅箓瘛

仢幙栤幰偐傜偺曉摎

MySQL偱偺巊梡偩偭偨偺偱偡偑爞腄B偺庬椶偼尵媦偣偢幙栤偝偣偰偄偨偩偒傑偟偨偺偱

嶲峫偵偝偣偰偄偨偩偒傑偡


2 仠 sanyozora
仠20芜草

http://www.yahoo.co.jp/

Yahoo! JAPAN

URL偼擂邪偱偡

椺偊偽っ疤拶est

id_no point

----------- -----------

1 50

2 12

3 33

4 45

5 39

6 33

偺傛偆側応崌

select a.*,

(select count(*)

from (select point

from test

group by point) b

where b.point > a.point) + 1 as rank

from test a

偺复貍抛莘莞迋獟菈羵艂珎軅贰

偙偺复貍餏ROM嬪偵偡傟偽Y摉棉袄偺纵份皋傪庢摼壜擻偱偡

仢幙栤幰偐傜偺曉摎

偁傝偑偲偆偛偞偄傑偡

偁偲偱偠偭偔傝撉傫偱尒傑偡


3 仠 wata5513
仠10芜草

http://www.hatena.ne.jp/1100142292

恖椡専嶕偼偰側 - 偡偛偔弶曕揑側幙栤偩偲巚偆偺偱偡偑殏獋艂膫珎軅箓瘛 SQL偱SELECT偡傞嵺媺授喊霓偵1񎎙4偺傛偆偵弴斣傪蹲褌蓲菈羵穫閸\暥偭偰偳偆偡傞偺偱偟偨偐..

url偼擂邪偱偡

order by 幃

偱偡

仢幙栤幰偐傜偺曉摎

1偺夞摎幰偺row_number偺傛偆側偙偲傪

MySQL偱傗傞曽朄傪扵偟偰偄傑偡


4 仠 偄偺偔偵
仠40芜草

http://dev.mysql.com/doc/mysql/ja/Variables.html

SET @tmp :=0;

SELECT *, @tmp := @tmp +1 AS tmp FROM table;

偙偺傛偆偵偡傟偽

蹲褨饥tmp散1, 2, 3, ゥィ偲

斣崋偑怳傜傟偰偄偒傑偡

仢幙栤幰偐傜偺曉摎

傑偝偟偔偙傟偱偡

偼偠傔偐傜MySQL偲尷掕偟偰幙栤偡傟偽傛偐偭偨

偐傕偟傟傑偣傫

奆偝傫偁傝偑偲偆偛偞偄傑偟偨


5 仠 kacchan6
仠20芜草

http://dev.mysql.com/doc/mysql/ja/example-AUTO_INCREMENT.htm...

底纲傒偨偄側rownum偱偼偁傝傑偣傫偑

冒剔賿鑻`偡傞偲偒偵帺摦偱草肛逸膫祩膫瓊陚槎籽傪掕媊偱偒傑偡

备窘偱尵偆蛋呐菔薨傒偨偄側暔偱偡

仢幙栤幰偐傜偺曉摎

冒剔賿鑻`偟偰偟傑偆偺偱偼側偔l乆側SELECT寢壥偱偺弴埵偲偄偆偐詬唫饌聜瘋絺﹤羵絺駛艂贰

奆偝傫偁傝偑偲偆偛偞偄傑偟偨

娭楢幙栤


仠幙栤傪傕偭偲扵偡仠



0.恖椡専嶕偼偰側寞踢
8.偙偺瓦凹迋饤F払偵徯夘
9.偙偺瓦凹迋虗鎿獋
懳墳婡庬堦棗
偍栤偄崌傢偣
唾踢/偍抦傜偣
鄹薏
柍椏瞻晦皳o榐
偼偰側寞踢