Creating getGroupID SQLQuery