Creating a query that will return specific days

pts.
Tags:
SQL
I have a field that defines the frequency of a specific tasks. In this field there are daily tasks, monthly tasks, calendar year tasks, and fiscal year tasks. I have no problem with getting the daily tasks and the monthly tasks, it is the others that I am having problems with. I have defined calendar year as the 2nd Tuesday in January and fiscal year as the 4th Tuesday in June. Please help!

Answer Wiki

Thanks. We'll let you know when a new response is added.

These problems can be solved using a calendar table. Check out this link

http://www.aspfaq.com/show.asp?id=2519

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Stevewaltz
    The NEXT_DAY date function should allow you to determine the dates for the calendar and fiscal years. A little adjustment is required because NEXT_DAY will not return the argument date specified, even if it is the day of the week argument provided (tuesday, in this case). This SQL subtracts 1 to go back to the last day of the previous month. I could have specified '20031231' and '20040531' in determining the calendar year and fiscal year dates respectively and would not have had to subtract 1 within the NEXT_DAY date argument. SELECT NEXT_DAY(TO_DATE('20040101','YYYYMMDD') - 1,'TUESDAY') + 7 "Calendar Year" FROM DUAL; SELECT NEXT_DAY(TO_DATE('20040601','YYYYMMDD') - 1,'TUESDAY') + 28 "Fiscal Year" FROM DUAL;
    0 pointsBadges:
    report
  • MwphData
    Fantastic, thanks for the quick responses. I will try them out... Regards Lou
    0 pointsBadges:
    report
  • Mcp111
    Note that the NEXT_DAY function is specific to Oracle.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following