Hi,
My client needs a report to show only new memberships between a certain period. I have been able to figure out how to get all memberships during the period, but I don't know how to pare that down to only show the memberships that are new and not renewals.
Here is my query for all memberships during a period:
SELECT cb.lastname, cb.firstname, cbp.name, cbs.status, cbs.expiry_date, u.email, cbs . *
FROM zH2b_comprofiler AS cb
LEFT JOIN zH2b_users AS u ON u.id = cb.user_id
LEFT JOIN zH2b_cbsubs_subscriptions AS cbs ON cbs.user_id = cb.user_id
LEFT JOIN zH2b_cbsubs_plans AS cbp ON cbs.plan_id = cbp.id
LEFT JOIN zH2b_user_usergroup_map AS ugm ON cb.user_id = ugm.user_id
WHERE u.block !=1
AND cb.approved =1
AND cb.banned =0
AND ugm.group_id =2
AND cbs.status = 'A'
AND cbs.plan_id >0
AND cbs.subscription_date > '2015-01-01 10:15:04'
AND cbs.subscription_date < '2015-02-01 10:15:04'
ORDER BY cbs.subscription_date DESC , cb.lastname ASC , `cb`.`firstname` ASC
What do I need to add to the query to get only new memberships?
I looked at the previous status field but didn't know what the codes mean, they were all R or I but the I ones had both new and renewals, same with the R.
Thank you.