Tuesday, July 10, 2012

DB2 : Select Current Year Records

Example:

SELECT Count(EL.SCREEN_MODULE_NAME) as ESH_NOOFHITS_CY,AT.DATE_TIME as ESH_TIMESTAMP_CY
FROM AUDT.TBL_AUDIT_TRAIL_SYSTEM AT ,ESERVICES_LIST EL
WHERE 
RTRIM(AT.SCREEN_MODULE_NAME) LIKE  '%'  CONCAT RTRIM( EL.SCREEN_MODULE_NAME) CONCAT '%'  AND
Year(CURRENT TIMESTAMP)=Year(DATE_TIME) 
GROUP BY AT.DATE_TIME
ORDER BY DATE(AT.DATE_TIME) ;

No comments:

Post a Comment