membership
table
- membership_startdate (2011-01-12)
- membership_dueday values like only dates (09,08,07)
- member_id
member
table
- member_id
How can I get count of the number of months that the member has paid till now and taking into consideration (membership_dueday)? Suppose if membership_startdate
is 2011-01-01 and membership_dueday
is 15, the the number of months count up to till now is 5.5
I have tried this code
SELECT COUNT(NUMBEROFMONTHS)
FROM membership
WHERE NUMBEROFMONTHS = PERIOD_DIFF(membership.membership_startdate, CURDATE());
It was giving error like this:
Error Code: 1054
Unknown column 'NUMBEROFMONTHS' in 'field list'
...but it does not taking into account the membership_dueday
...