title: SQL Query to return different values of a column having same id in another column in same row
body: <p>My table 'Details' looks like this,</p>
  
  <pre><code>ID    Name    City
  1     Arun    Chennai
  2     Arun    Mumbai
  3     Raj     Bangalore
  4     Raj     Chennai
  </code></pre>
  
  <p>I want to select the same Name containing different values in 'City' column in a single row.</p>
  
  <p>I have written the below query</p>
  
  <pre><code>select a.id, b.id, a.Name, a.city, b.city 
  from Details a join Details b on a.Name = b.Name
  where a.City &lt;&gt; b.City
  </code></pre>
  
  <p>For which the output is</p>
  
  <pre><code>id id Name City      City
  1  2  Arun Chennai   Mumbai
  2  1  Arun Mumbai    Chennai
  3  4  Raj  Bangalore Chennai
  4  3  Raj  Chennai   Bangalore
  </code></pre>
  
  <p>But I need the output in one row with both id's and City's</p>
  
  <pre><code>id id Name City      City
  1  2  Arun Chennai   Mumbai
  3  4  Raj  Bangalore Chennai
  </code></pre>
  
  <p>Kindly advise</p>