I need some help with a SQL query to find expired members by a period of time. I need to be able to search for members by the date of expired product payment (only one product per member) instead of the date they became members.... because many members have been members for several consecutive years and if I were to query by date member "added" it would not account for these expired members. Thanks in advance! KCarey
You can use this query : Code: select * from amember_payments p left join amember_members m on p.member_id = m.member_id where p.tm_completed > '2010-01-01' and p.tm_completed < '2011-01-01' and p.completed =1 and p.expire_date < now() This will return all payments that were completed on past year but expired for now.
Thanks for the SQL. I need one more step. I want to find the current expired members with an expired payment within the last year. The current query found expired payments in the last year, but includes both expired and current active members. Thanks again for your help! kcarey
add this at the end of the query: Code: select * from amember_payments p left join amember_members m on p.member_id = m.member_id where p.tm_completed > '2010-01-01' and p.tm_completed < '2011-01-01' and p.completed =1 and p.expire_date < now() and m.status=2