SQL to remove accounts from groups?

SQL to remove accounts from groups?

Comments

  • I have moved a copy of our production environment to a test environment, because of this I have groups with accounts that I want to empty. Is there an SQL query that can help with this?

  • Hello!

    This is the query you could use for that purpose:

    select * from account_group_join
    where account_id != ADMINISTRATOR ACCOUNT

    If you turn this into a delete statement, it will delete all group associations except the default admin account of course. Also note that you can filter GROUP_ID to exclude "GROUP" to return more specified associations.

    entity_group is the group table to reference if youre looking for group names. You will need to perform a restart for these changes to be effective.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!