Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display only certain year data [SYSDATE] 1

Status
Not open for further replies.

soushi01

Technical User
Dec 27, 2010
31
MY
Hi

I need to create new statement report , which report criteria is this report don't want show Fees for 2014 [cry]

Here is the table called STATEMENT

NAME ---- ITEM_FEES -------- PAYMENT_DUE_DATE
John ---- E-Learning Fees ----- 14-02-2011
John ---- Course Fee 1 -------- 14-03-2011
John ---- Course Fee 2 -------- 14-09-2011
John ---- Course Fee 3 -------- 14-03-2012
John ---- Course Fee 4 -------- 14-09-2012
John ---- Course Fee 5 -------- 14-03-2013
John ---- Course Fee 6 -------- 14-09-2013
John ---- Course Fee 7 -------- 14-03-2014
John ---- Course Fee 8 -------- 14-09-2014
John ---- Course Fee 9 -------- 14-03-2015
John ---- Course Fee 10 ------- 14-09-2015


but I want display like this (Expected result)

NAME ---- ITEM_FEES -------- PAYMENT_DUE_DATE
John ---- E-Learning Fees ----- 14-02-2011
John ---- Course Fee 1 -------- 14-03-2011
John ---- Course Fee 2 -------- 14-09-2011
John ---- Course Fee 3 -------- 14-03-2012
John ---- Course Fee 4 -------- 14-09-2012
John ---- Course Fee 5 -------- 14-03-2013
John ---- Course Fee 6 -------- 14-09-2013

I can write like this but this is "hardcode" .... [cry]
SELECT *FROM STATEMENT WHERE TRUNC(PAYMENT_DUE_DATE,'YYYY') NOT in ('2014,2015')

I looking another solution but using function SYSDATE minus year but i hv not idea write it... [hammer]
Any ideas ?

thanks
 
Like this ?
WHERE TRUNC(PAYMENT_DUE_DATE,'YYYY') <= TRUNC(SYSDATE,'YYYY')

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
And in ANSI-SQL:
WHERE EXTRACT(YEAR FROM PAYMENT_DUE_DATE) <= EXTRACT(YEAR FROM CUUENT_DATE)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top