title: Convert multiple SQL rows into one row
body: <p>Afternoon good people of Stack Overflow.</p>
  
  <p>I am trying to do something that I am not certain how to achieve with my SQL knowledge, but I have a clear idea what it is I want out of this so hopefully this will make sense to people.</p>
  
  <p>I have some perfmon disk results that look like this:</p>
  
  <pre><code>DatabaseName    ObjectName      CounterName         InstanceName                Server      Average
  DAG1DB01        logicaldisk     avg. disk sec/read  d:\mountpoints\DAG1DB01     Server1     13.616
  DAG1DB01        logicaldisk     avg. disk sec/read  d:\mountpoints\DAG1DB01     Server2     17.508
  DAG1DB01        logicaldisk     avg. disk sec/read  d:\mountpoints\DAG1DB01     Server3     12.775
  DAG1DB01        logicaldisk     avg. disk sec/read  d:\mountpoints\DAG1DB01     Server4     13.148
  DAG1DB01        logicaldisk     avg. disk sec/read  d:\mountpoints\DAG1DB01     Server5     10.091
  </code></pre>
  
  <p>These are example rows based on this query:</p>
  
  <pre><code>SELECT
  e14_db.DatabaseName AS [DatabaseName],
  d.ObjectName,
  d.CounterName,
  d.InstanceName,
  d.Server,
  AVG(Value) * 1000 AS [Average]
  FROM E14_Perfmon_MBX AS d
  INNER JOIN E14_Databases AS e14_db
  ON e14_db.LogFolderPath = d.InstanceName
  WHERE d.ObjectName = 'logicaldisk'
  AND d.CounterName = 'avg. disk sec/read'
  AND d.DateTime &gt; (DATEADD(hh, -4, GETDATE()))
  AND d.Value &lt; 1
  GROUP BY d.ObjectName, d.CounterName, d.InstanceName, d.Server, e14_db.DatabaseName
  ORDER BY e14_db.DatabaseName, d.Server
  </code></pre>
  
  <p>What I want is this:</p>
  
  <pre><code>DatabaseName    ObjectName      CounterName         InstanceName                Server1     Server2     Server3     Server4     Server5
  DAG1DB01        logicaldisk     avg. disk sec/read  d:\mountpoints\DAG1DB01     13.616      17.508      12.775      13.148      10.091
  </code></pre>
  
  <p>Does anyone know how I can achieve this? basically applying the rows onto themselves?</p>
  
  <p>If any clarification is needed please feel free to ask.</p>
  
  <p>Thanks!</p>