Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Need Help on where clause

Need Help on where clause

Need Help on where clause

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

RE: Need Help on where clause

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
when MONTH(current date) < 7
then YEAR(current date ) - 1
else YEAR(current date )



Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close