|
SELECT A1.ETL_DATE, A1.MARKET_CODE
, A1.DECLARATION_DT
, ROW_NUMBER() OVER(PARTITION BY A1.MARKET_CODE, A1.STOCK_CODE, DATE_PART('YEAR', DATE(A1.DECLARATION_DT)) ORDER BY A1.DECLARATION_DT DESC) AS RN
FROM tb_date_type_casting A1;
SELECT A1.ETL_DATE, A1.MARKET_CODE
, A1.DECLARATION_DT
, ROW_NUMBER() OVER(PARTITION BY A1.MARKET_CODE, A1.STOCK_CODE, DATE_PART('YEAR', DATE(A1.DECLARATION_DT)) ORDER BY A1.DECLARATION_DT DESC) AS RN
FROM tb_date_type_casting A1;
|
|
|
SELECT A1.ETL_DATE, A1.MARKET_CODE
, A1.DECLARATION_DT
, ROW_NUMBER() OVER(PARTITION BY A1.MARKET_CODE, A1.STOCK_CODE, DATE_PART('YEAR', CAST(A1.DECLARATION_DT AS DATE)) ORDER BY A1.DECLARATION_DT DESC) AS RN
FROM tb_date_type_casting A1;
|
|