Elimiate records with dates in the same month (1 Viewer)

pr2-eugin

Super Moderator
Local time
Today, 11:16
Joined
Nov 30, 2011
Messages
8,494
I am having a fry up day. I am trying to figure out a logical WHERE condition.

I have a Query that gives me data,
Code:
Name    |    Start        |    End
--------+-----------------+-------------
[COLOR=Red]Paul[/COLOR]    |    30-May-15    |    
[COLOR=RoyalBlue]Eugin[/COLOR]   |    21-May-15    |    28-May-15
[COLOR=Red]Francis[/COLOR] |    04-Mar-15    |    08-May-15
[COLOR=RoyalBlue]Samuel[/COLOR]  |    10-May-15    |    13-May-15
Now in the above example, I want to have only Paul and Francis. As Eugin start is 21-05-2015 and End is the same month, so is Samuel's. So I want to eliminate those two records.

I have checked pbaldy's web of overlapping records. But unlike that, I need something customised.

Begins and ends before range - we don't want - Yes
Begins before, ends during - we want this one - Yes
Begins and ends during - we want this one too - NO
Begins during and ends after - we also want this one - Yes
Begins and ends after - we don't want this one - Yes
Begins before and ends after - we want this one -NO

Could someone help me figure out the logic? Please !!
 

spikepl

Eledittingent Beliped
Local time
Today, 12:16
Joined
Nov 3, 2010
Messages
6,144
Your required criteria have remained a deep mystery. Especially mixing double negations into it is confusing.

DO you want all records, except records that began AND ended within some specified period? What period?

Did you actually mean select all records, but throw away any that have an ending date in the same month as the begin date?
 

pr2-eugin

Super Moderator
Local time
Today, 11:16
Joined
Nov 30, 2011
Messages
8,494
Okay, in simple terms. SELECT all records whose MonthAndYear(StartDate) <> MonthAndYear(EndDate). I am working with MSSQL, so Access' Format might not come in handy.

The Period I am running is between 01 May 2015 and 31 May 2015
 

spikepl

Eledittingent Beliped
Local time
Today, 12:16
Joined
Nov 3, 2010
Messages
6,144
WHERE Not (Month(Start)=Month(End) AND Year(start)=Year(End)) ?
 

vbaInet

AWF VIP
Local time
Today, 11:16
Joined
Jan 22, 2010
Messages
26,374
A bit confusing as well Paul. spikepl's description is the way I understand it.

Edit: Didn't see the last two posts.
 

pr2-eugin

Super Moderator
Local time
Today, 11:16
Joined
Nov 30, 2011
Messages
8,494
Thanks spikepl. That worked, I was thinking a bit funny yesterday ! It is all good now. :D
 

Users who are viewing this thread

Top Bottom