sysdate 为系统日期时间,BIRTH_DATE 为表中出生日期字段
SELECTCOUNT( * )
FROMBARN_SWALLOW_INFO
WHEREVALID_FLAG = 1 AND IS_JINQIAO = 1 AND TRUNC( months_between( SYSDATE, BIRTH_DATE ) / 12 ) >= 25 AND TRUNC( months_between( SYSDATE, BIRTH_DATE ) / 12 ) <= 27SELECTTRUNC( ( to_char( SYSDATE, 'yyyyMMdd' ) - to_char( BIRTH_DATE, 'yyyyMMdd' ) ) / 10000 ) AS age
FROMBARN_SWALLOW_INFO