Answers.Body: <p>This is how you set the address of all people in a certain group (group id = 13), to be the address of a specific, different contact (address id 15432)</p>
  
  <p>SET @InGroup:=13;
  SET @MasterAddress:=15432;</p>
  
  <p>UPDATE civicrm_address SET master_id = @MasterAddress
  WHERE contact_id IN
      (SELECT contact_id
      FROM civicrm_group_contact
      WHERE status = 'Added'
      AND group_id = @InGroup)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-25T11:36:27.027Z
Answers.LastActivityDate: 2017-06-25T11:36:27.027Z
Answers.UserDisplayName: Elad
Answers.Body: <p>One way you can do this is to use the Advanced Search under the "Search" link on the Civi navigation bar. Expand the Address Fields tab, enter the address. This should produce a list of users with the indicated address. Now you can check all the users and use the dropdown to add them into the group.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-26T09:36:00.313Z
Answers.Text: I don't think you understood what I mean.
  I have a group of contacts, and I want to set their primary address, of all of them, to the address of another contact's address (the address of the organization they are all part of)
Answers.UserDisplayName: Elad
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-26T19:38:39.050Z
Answers.Text: Have you tried the "Import Contacts" under Contacts? If you run identify all the group of contacts that needs their primary address changed, you can setup a spreadsheet with the updated address column and map it. However, I never tried this with data replacement.
Answers.UserDisplayName: Kristine
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-26T02:33:07.180Z
Answers.LastActivityDate: 2017-04-26T02:33:07.180Z
Answers.UserDisplayName: Kristine
Body: <p>I would like to link one contact's address to the main address of a group of many other contacts.
  I see how to do this manually for one contact, but I cannot find a way to to this in a bulk way for a whole group.
  Thank you</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-06-25T04:25:11.517Z
Comments.Text: Pls provide a clear example of what you require. I think no one has understood you properly
Comments.UserDisplayName: petednz - fuzion
Tags: <contacts><groups><addresses>
Title: How to link one contact's address to be the address of all contacts in a specific group via SQL?
ThreadText: # How to link one contact's address to be the address of all contacts in a specific group via SQL?
  
  (Asked by: username_0 on 2017-04-25)
  
  I would like to link one contact's address to the main address of a group of many other contacts.
  I see how to do this manually for one contact, but I cannot find a way to to this in a bulk way for a whole group.
  Thank you
  
  **Tags:** contacts, groups, addresses
  
  > **Comments:**
  > **username_1**: Pls provide a clear example of what you require. I think no one has understood you properly  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-06-25. Score: 3
  
  This is how you set the address of all people in a certain group (group id = 13), to be the address of a specific, different contact (address id 15432)
  
  SET @InGroup:=13;
  SET @MasterAddress:=15432;
  
  UPDATE civicrm\_address SET master\_id = @MasterAddress
  WHERE contact\_id IN
  (SELECT contact\_id
  FROM civicrm\_group\_contact
  WHERE status = 'Added'
  AND group\_id = @InGroup)
  
  
  ---
  
  ### Answer by username_2 on 2017-04-26. Score: 1
  
  One way you can do this is to use the Advanced Search under the "Search" link on the Civi navigation bar. Expand the Address Fields tab, enter the address. This should produce a list of users with the indicated address. Now you can check all the users and use the dropdown to add them into the group.
  
  > **Comments:**
  > **username_0**: I don't think you understood what I mean. I have a group of contacts, and I want to set their primary address, of all of them, to the address of another contact's address (the address of the organization they are all part of)  
  > **username_2**: Have you tried the "Import Contacts" under Contacts? If you run identify all the group of contacts that needs their primary address changed, you can setup a spreadsheet with the updated address column and map it. However, I never tried this with data replacement.  
  
  ---
  
  