This query copies the group permissions from one group to another. To use it:

1) Make sure you back your database up before you do anything else!
2) Add a new group in your AppGini app.
3) Open up your favorite SQL tool and get the groupID of the source group (my source group was 5)
4) Get the groupID of the new one you just created (my destination group was 13)
5) Copy and paste this query into your SQL tool and edit the 5 and 13 to match your groupID's
6) Run the query
7) Open your app and make the final changes to the new group


############# Query Follows Below Here ################
#Copy group permissions from group 5 to group 13
#

#Prevent automatic commits
SET autocommit = 0;

#Create temp table with rows from source group
CREATE TEMPORARY TABLE tmpPerms
SELECT * FROM membership_grouppermissions WHERE groupID = 5;

#Drop the primary key in the temp table
ALTER TABLE tmpPerms DROP permissionID;

START TRANSACTION;

#Update copied records with new group ID
UPDATE tmpPerms SET groupID = 13;

#Purge original permissions
DELETE FROM membership_grouppermissions WHERE groupID = 13;

#Insert copied permissions into table
INSERT INTO membership_grouppermissions SELECT 0,tmpPerms.* FROM tmpPerms;

COMMIT;

#Remove the temp table
DROP TEMPORARY TABLE tmpPerms;

#Allow automatic commits
SET autocommit = 1;

######################## End of Query ########################