title: pivot on first field
body: <p>I have no idea how to do make this work... I have to return my data to look like this </p>
  
  <pre><code> Vendor1, sum(field1), sum(field2), sum(field3), sum(field4)...
   Vendor2, sum(field1), sum(field2), sum(field3), sum(field4)...
   Vendor3, sum(field1), sum(field2), sum(field3), sum(field4)...
   Vendor4, sum(field1), sum(field2), sum(field3), sum(field4)...
  </code></pre>
  
  <p>But, my data keeps returning like so</p>
  
  <pre><code> Vendor1, field1, field2, filed3 field4...
   Vendor1, field1, field2, filed3 field4...
   Vendor1, field1, field2, filed3 field4...
   Vendor1, field1, field2, filed3 field4...
  </code></pre>
  
  <p>Here's a bit of what I have so far </p>
  
  <pre><code>select substring(a.warehouse, 2, len(a.warehouse)) as 'Name of Vendor',
   Case 
   when b.status = 3 then
   sum(b.id) over (partition by substring(a.warehouse, 2, len(a.warehouse)))
   else 0
   End as 'Number of Orders',
   Case 
   when b.status = 4 then
   sum(b.P_Name) over (partition by substring(a.warehouse, 2, len(a.warehouse)))
   else 0
   End as 'Number of Items'
   from [Table1]a
   join [Table2]b
   on a.OrderID = b.OrderID
  </code></pre>
  
  <p>I have a number of additional case statements that do similar to the one shown. <br/></p>
  
  <p>What I don't know is <strong><code>how to pivot this as a grouping</code></strong>.   </p>
  
  <p>I hope that I explained things clearly.  Thanks for all help in advance.</p>