title: SQL Pivot Data w/o Aggregate
body: <p>I have a table that is structured like so:</p>
  
  <pre><code>ID | Type | PrimaryInd | SecondaryInd | TertiaryInd
  ---------------------------------------------------
  12 | Boat |     0      |      1       |     0  
  12 | Auto |     1      |      1       |     1
  12 | Home |     1      |      0       |     1
  </code></pre>
  
  <p>And I am trying to get the results for each ID to be on one row like so:</p>
  
  <pre><code>ID | BoatPrimaryInd | BoatSecondaryInd | BoatTertiaryInd | AutoPrimaryInd | ...
  -------------------------------------------------------------------------------
  12 |       0        |        1         |        0        |       1        | ...
  </code></pre>
  
  <p>I currently have my query set up like this using a CASE and GROUP BY:</p>
  
  <pre><code>SELECT 
     ID,
     MIN(CASE WHEN Type = 'Boat' THEN PrimaryInd+0 END) AS BoatPrimaryInd,
     ...
  FROM Table
  GROUP BY ID
  </code></pre>
  
  <p>Is this the most effecient way of doing this? I tried looking into PIVOT tables but I'm not sure that's what I need since I don't have anything to aggregate here...</p>