SQL and renewed members

Discussion in 'Customization & add-ons' started by kcarey, Feb 4, 2011.

  1. kcarey

    kcarey Member

    Joined:
    Dec 27, 2009
    Messages:
    42
    I'm looking to run a SQL query for members who renewed in 2010.... but need help with the SQL string.

    Any help would be appreciated. I'm using phpMyAdmin. I'm not a developer or programmer... but know the basics.

    Thanks,

    K Carey
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    What results you need to select ? users who repurchase the same product, or users who repurchase any product? Also, should users who also signup in 2010 year be included in result?(for example if user signup and renewed in 2010?)
  3. kcarey

    kcarey Member

    Joined:
    Dec 27, 2009
    Messages:
    42
    Alex,

    I would like to select repurchase of any product... and exclude new members (of any products) for 2010. I do not have any members that would be subscribed to more than 1 product (membership).

    Thanks for your help,

    K Carey
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Ok.
    Code:
    select * from amember_members where member_id in (select distinct(m.member_id) from amember_members m left join amember_payments p on p.member_id = m.member_id where  m.added < '2010-01-01' and status >0 and p.tm_completed > '2010-01-01' and tm_completed < '2011-01-01' and completed=1)
  5. kcarey

    kcarey Member

    Joined:
    Dec 27, 2009
    Messages:
    42
    Perfect! Thanks for your help.

    K Carey

Share This Page