I'm trying to figure out how to set a limit, a date range limit for a year span.
A season is Jul - Jun for most members.
Another words, in this current season it would be 7/1/13 - 6/30/2014 for Regular Members
For other members their season is 10/1/13 - 9/30/2014.
How do I set the season end date (EndDate) of their membership so that the dates do not have to be manually changed.
So that it dynamically changes when the time comes?
So right now to do something like
YEAR(attribute.PersonMembership.EndDate) = YEAR({ fn CURDATE() })
Full statement here:
Code:
SELECT lookup.MemberTypes.Id AS MemberTypeID, lookup.MemberTypes.MemberGroup, lookup.MemberTypes.Description AS MemberType, entity.Person.Status, entity.Person.MembershipNumber, attribute.PersonMembership.StartDate, attribute.PersonMembership.EndDate, attribute.PersonMembership.PaymentDate,
YEAR(attribute.PersonMembership.EndDate) AS EndYear,
attribute.PersonMembership.PersonId
FROM entity.Person INNER JOIN
attribute.PersonMembership ON entity.Person.Id = attribute.PersonMembership.PersonId RIGHT OUTER JOIN
lookup.MemberTypes ON attribute.PersonMembership.MembershipTypeId = lookup.MemberTypes.Id
WHERE (lookup.MemberTypes.Id BETWEEN 24 AND 31) AND (YEAR(attribute.PersonMembership.EndDate) = YEAR({ fn CURDATE() }) OR
YEAR(attribute.PersonMembership.EndDate) IS NULL)
I do get all the records with their membership ending this year.
HOWEVER when June comes this year and when September comes this year the Year limit to this year won't work. Because that's the start of the next season.
I hope I made sense.
Right now I can't think of a way to set it so there is no user entry to change it when the new season comes in the current year.
I'm thinking something like this:
MONTH(attribute.PersonMembership.EndDate) as EndMonth = 6
YEAR(attribute.PersonMembership.EndDate) as EndYear = YEAR(GETDATE())
but at a loss on when July comes since starting July (and for the other members September) the Year(GETDATE()) doesn't work because it's only looking at this year. It needs to look at next year (next season).