MySQL Limit 에서 Oracle Rownum 변환

agnusdei·2023년 7월 5일
0
post-custom-banner

Mysql

SELECT
      	*
  FROM  TABLE_NAME
 WHERE	TABLE_NAME.SEQ = TABLE_NAME2.SEQ
 LIMIT  10
 
SELECT  FR_SEQ						   	    
     ,  DATE_FORMAT(FR_RGST_DT,'%Y.%m.%d') 
	 ,  F_USER_NM(FR_RGST_ID) 				
	 ,  FR_ATCH_FILE_ID 				
	 ,	FR_TITLE						
	 ,  FR_CONT 							
	 ,  FR_ID 						
	 ,  DATE_FORMAT(FR_DT,'%Y.%m.%d')	 
  FROM 	T_FREE
 WHERE	FR_USE_YN='Y'
 ORDER	BY FR_SEQ DESC
 LIMIT  #{firstIndex} , #{recordCountPerPage}

Oracle

-- SQLINES LICENSE FOR EVALUATION USE ONLY
SELECT
      	*
  FROM  TABLE_NAME
 WHERE	TABLE_NAME.SEQ = TABLE_NAME2.SEQ AND rownum <= 10
 
 
 
-- SQLINES LICENSE FOR EVALUATION USE ONLY
SELECT	* FROM (SELECT FR_SEQ			
	 ,	TO_CHAR(FR_RGST_DT,'YYYY.MM.DD') 	
	 ,	F_USER_NM(FR_RGST_ID) 					
	 ,	FR_ATCH_FILE_ID 						
	 ,	FR_TITLE						  
	 ,	FR_CONT 						
	 ,	FR_ID 						
	 ,	TO_CHAR(FR_DT,'YYYY.MM.DD')			
  FROM	T_FREE
 WHERE	FR_USE_YN='Y'
 ORDER	BY FR_SEQ DESC
	 )  
  WHERE rownum <= #{firstIndex} , #{recordCountPerPage}
post-custom-banner

0개의 댓글