Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Exclude certain time periods

$
0
0
Hi I have a table with the following fields:

person
from_dt
to_dt
house_num

it describes what house number a person lived in, and gives the from_dt and to_dt. The from_dt date back to 2000-01-01 and the to_dt dates to 2012-01-01

The Question:

I want to only select people who have lived for some point between 2004 and 2009.

ie exclude people like

person----from_dt-----------to_dt------------house_num
dave------2000-01-01-------2002-01-01------34

however keep someone like:

person----from_dt-----------to_dt------------house_num
susan------2008-01-01-------2009-06-01------93

I am having trouble with the logic here. Does anyone have any suggestions of how I can use the from_dt and to_dt to only include people who have lived in a house for a day or more during 2009?

Thanks very much.

Viewing all articles
Browse latest Browse all 13329

Trending Articles