diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-step_02.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-step_02.sql
index 91739e005a1bd80fdde2b6e0fa92853e4a0d32e4..859fc9e80f3c20fdb714fc6b6e73141299857ff6 100644
--- a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-step_02.sql	
+++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-step_02.sql	
@@ -87,4 +87,4 @@ insert into SMP_RESOURCE_MEMBER ( CREATED_ON, LAST_UPDATED_ON, MEMBERSHIP_ROLE,
 
 -- the SMP Resource memberships
 insert into SMP_RESOURCE_MEMBER ( CREATED_ON, LAST_UPDATED_ON, MEMBERSHIP_ROLE, FK_RESOURCE_ID, FK_USER_ID)
-    select NOW(), NOW(), 'ADMIN', ow.FK_SG_ID, usr.ID from BCK_USER usr JOIN BCK_OWNERSHIP ow ON ow.FK_USER_ID = usr.id  where usr.ROLE='SERVICE_GROUP_ADMIN';
+    select NOW(), NOW(), 'ADMIN', sgd.ID, usr.ID from BCK_USER usr JOIN BCK_OWNERSHIP ow ON ow.FK_USER_ID = usr.id JOIN BCK_SERVICE_GROUP_DOMAIN sgd ON sgd.FK_SG_ID=ow.FK_SG_ID where usr.ROLE='SERVICE_GROUP_ADMIN';