神魂顛倒

          Memo

             :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            0 隨筆 :: 3 文章 :: 3 評(píng)論 :: 0 Trackbacks
        1. The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be non-negative integer constants (except when using prepared statements).

          With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):

          SELECT * FROM tbl LIMIT 5,10;  # Retrieve rows 6-15
          

          To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:

          SELECT * FROM tbl LIMIT 95,18446744073709551615;
          

          With one argument, the value specifies the number of rows to return from the beginning of the result set:

          SELECT * FROM tbl LIMIT 5;     # Retrieve first 5 rows
          

          In other words, LIMIT row_count is equivalent to LIMIT 0, row_count.

          For prepared statements, you can use placeholders. The following statements will return one row from the tbl table:

          SET @a=1;
          PREPARE STMT FROM 'SELECT * FROM tbl LIMIT ?';
          EXECUTE STMT USING @a;
          

          The following statements will return the second to sixth row from the tbl table:

          SET @skip=1; SET @numrows=5;
          PREPARE STMT FROM 'SELECT * FROM tbl LIMIT ?, ?';
          EXECUTE STMT USING @skip, @numrows;
          

          For compatibility with PostgreSQL, MySQL also supports the LIMIT row_count OFFSET offset syntax.

        2. (select * order by id LIMIT 35,20)

          posted on 2008-04-06 23:47 star 閱讀(112) 評(píng)論(0)  編輯  收藏 所屬分類: MySQL

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 洛浦县| 巴彦淖尔市| 扎鲁特旗| 乌兰察布市| 天门市| 区。| 嘉定区| 黄龙县| 门头沟区| 鄂托克前旗| 城固县| 类乌齐县| 公主岭市| 滕州市| 新干县| 崇明县| 商都县| 柯坪县| 阆中市| 龙山县| 青冈县| 赞皇县| 黄平县| 固镇县| 云霄县| 尼木县| 禹城市| 房产| 岳西县| 巧家县| 镇赉县| 许昌县| 灵石县| 内黄县| 泊头市| 灵璧县| 象州县| 广河县| 文化| 元朗区| 曲阳县|