Your skill will accomplish what the force of many cannot |
|
PerlMonks |
(OT) Complex SQL Statementby boblawblah (Scribe) |
on Jul 23, 2008 at 18:41 UTC ( [id://699666]=perlquestion: print w/replies, xml ) | Need Help?? |
boblawblah has asked for the wisdom of the Perl Monks concerning the following question:
(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!
Back to
Seekers of Perl Wisdom
|
|