(I know there are SQL forums out there, but everyone here is so helpful)
I am writing scheduling software. There is a database of projects that have a ProjectedStart and ActualStart, and ProjectedFinish and ActualFinish variables.
With one sql statement I want to get the projects that are (potentially) active for a given date. I have my logic sorted out for the most part, but I need to translate into SQL and had trouble with the help docs I found.
So basically I need to check that the given date is between two dates. DATE1 and DATE2.
DATE1 = ActualStart or ProjectedStart;
DATE2 = ActualFinish or ProjectedFinish;
(Use the actual date if there is one, if not use the projected.)
However, if there is no actual or projected start, the record should be selected as long as the given date is before projected/actual finish date.
If there is no finish, the record should be selected as long as the given date is after the projected/actual start date.
If there is neither a start nor finish date, then the record should be selected.
THANK YOU for any input you can give me!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.