membership
表
member
表
如何计算会员到目前为止所支付的月数并考虑(membership_dueday)?假设membership_startdate
是2011-01-01且membership_dueday
是15,那么到目前为止的月数是5.5
我试过这段代码
SELECT COUNT(NUMBEROFMONTHS)
FROM membership
WHERE NUMBEROFMONTHS = PERIOD_DIFF(membership.membership_startdate, CURDATE());
这是错误的:
错误代码:1054
“字段列表”中的未知列“NUMBEROFMONTHS”
...但它未考虑membership_dueday
...