en
Language
  • en
  • cs
  • hu
  • de
  • fr
  • es
  • br
  • ru
  • kr
  • jp
AI translation
  • it
  • pl
  • tr

How to Move All the Users from One Group to Another?

Introduction

This guide explains how to move all users from one group to another in Easy8 using a direct SQL command. This is useful when you want to merge groups or clean up outdated group structures. The method involves updating records in the database.

Target Audience

  • Administrator

Prerequisites

Before starting, ensure you have:

  • Access to the application database (e.g., via MySQL)
  • Proper database backup in case a rollback is needed
  • The ID numbers of both the old and new groups
  • Confirmation that the target group ID exists

How to Move Users Between Groups

Step 1: Open Database Console

Use a tool such as MySQL or a database manager to access your application database.

mysql -u [username] -p -h [host]

Step 2: Select the Application Database

USE [database_name];

Step 3: Run the SQL Update Command

Replace [old_group_id] and [new_group_id] with your actual values.

UPDATE groups_users SET group_id = [new_group_id] WHERE group_id = [old_group_id];

Example

To move all users from group ID 20 to group ID 10:

UPDATE groups_users SET group_id = 10 WHERE group_id = 20;

Important Warning

Make sure the target group ID (e.g., 10 in the example) exists before executing the command. Moving users to a non-existent group ID can lead to application errors.

You can verify group IDs with:

SELECT id, lastname FROM groups;

Conclusion

You have successfully moved all users from one group to another using an SQL command. Always double-check the group IDs and have a backup before running such commands to avoid data loss or errors.

Related Topics and Further Reading

Try Easy8 in 30 days free trial

Access all features, SSL protected, no credit card required.