title: SQL query to remove duplicate column values within distinct rows
body: <p>I am using MS SQL, I have tables "Table1" , "Table2" , "Table3" as mentioned below(might look like a mess, I dont know how to make a table better here).
  I want the "Expected OutPut" as mentioned ant the bottom.</p>
  
  <p>Want a SQL script to perform this action. </p>
  
  <p><strong>Table 1</strong></p>
  
  <pre><code>FamilyID FamilyName
  1        One
  2        Two
  3        Three
  </code></pre>
  
  <p><strong>Table2</strong></p>
  
  <pre><code>FamilyID UserID UserName
  1        1      Name1
  1        2      Name2
  1        3      Name3
  2        4      Name4
  2        5      Name5
  2        6      Name6
  2        7      Name7
  2        8      Name8
  3        9      Name9
  3        10     Name10
  </code></pre>
  
  <p><strong>Table3</strong></p>
  
  <pre><code>FamilyID RoomID RoomType
  1        1      RoomType1
  1        2      RoomType2
  2        1      RoomType1
  2        2      RoomType2
  2        3      RoomType3
  2        2      RoomType2
  </code></pre>
  
  <p><strong>Expected OutPut</strong></p>
  
  <pre><code>FamilyID UserName RoomType
  1        Name1    RoomType1
           Name2    RoomType2
           Name3
  2        Name4    RoomType1
           Name5    RoomType2
           Name6    RoomType3
           Name7
           Name8
  3        Name9    RoomType2
           Name10
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I tried <a href="https://stackoverflow.com/questions/20299860/how-to-show-column-value-only-one-time-if-it-is-repeated-and-blank-until-differe">how to show column value only one time if it is repeated and blank until different value comes in sql </a> but the out put is not as i expected. It has duplications as sample shown below for FamilyID=1</p>
  
  <p><strong>Result</strong> from <a href="https://stackoverflow.com/questions/20299860/how-to-show-column-value-only-one-time-if-it-is-repeated-and-blank-until-differe">how to show column value only one time if it is repeated and blank until different value comes in sql </a></p>
  
  <pre><code>FamilyID UserName RoomType
  1        Name1    RoomType1
           Name2    RoomType1
           Name3    RoomType1
           Name1    RoomType2
           Name2    RoomType2
           Name3    RoomType2
  </code></pre>
  
  <p><strong>Expected OutPut</strong></p>
  
  <pre><code>FamilyID UserName RoomType
  1        Name1    RoomType1
           Name2    RoomType2
           Name3
  </code></pre>