Tuesday, August 04, 2009

So this has taken me like...an hour to figure out at work so I thought I'd share with everyone;


The problem is, I have to select things from a database, and they always have a start date assigned, but not all have an end date. So how do you properly select everything that falls within those ranges?


THE RULES FOR DATE SELECTION
============================

If there is an END DATE

The Date you are selecting from has to be before or equal to the data's StartDate
The Date you are selecting to has to be greater than the data's EndDate


If there is NO END DATE

The Date you are selecting from has to be before or equal to the data's StartDate
The Date you are selecting to has to be greater than the data's StartDate



To be honest this is more a reminder to myself so I won't forget something so trivially simple made me feel retarded. Yay for solving problems!

No comments: