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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help on where clause

Status
Not open for further replies.
Aug 13, 2009
29
0
0
US
WHERE DATE(LPAY.ADDED_DT) between date( '07' || '-' || '01' || '-' || CHAR(YEAR(current date )))
and (((DATE(current date) - Day(DATE(current date)) day)+1 day)) - 1 day

Above is my where clause which works fine, I alwuas wants to get data from July to June and chnages next year
But problem here is after December year will change to 2010,
can i write a case statement in a way that year will only increment after june(fiscal year time period)?
Thanks so much
 
if I get it correctly you wish to retrieve data as follows.

if current month is less than july you wish to retrieve all data from july previous year till current date. else you wish to retrieve all data from july current year until current date.

if so then following may give you what you want (untested)

replace "CHAR(YEAR(current date ))" with
CHAR(
case
when MONTH(current date) < 7
then YEAR(current date ) - 1
else YEAR(current date )
end)




Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top