分页查询SQL

时间:2021-04-02 15:50:44

SELECT
 *
FROM
 ( SELECT
   T.*,
   ROWNUMBER() OVER() AS ROWNUM
  FROM
   ( SELECT
     L4_GDS_GROUP_CD CODE,
     L4_GDS_GROUP_DESC NAME
    FROM
     DM_GDS_GROUP_INF_TD
    WHERE
     (L4_GDS_GROUP_CD LIKE '%手工制作%' OR
     L4_GDS_GROUP_DESC LIKE '%手工制作%') FETCH FIRST 50 ROWS ONLY
   )
   T
 )
WHERE
 ROWNUM > 0 AND
 ROWNUM <= 50