title: "Pivoting" a Table in SQL (i.e. Cross tabulation / crosstabulation)
body: <p>I'm working on trying to generate a report from a couple of database tables. The simplified version looks like this</p>
  
  <pre><code>Campaign
  ----------
  CampaignID
  
  Source
  -----------------------
  Source_ID | Campaign_ID
  
  Content
  ---------------------------------------------------------
  Content_ID | Campaign_ID | Content_Row_ID | Content_Value
  </code></pre>
  
  <p>The report needs to read like this:</p>
  
  <pre><code>CampaignID - SourceID - ContentRowID(Value(A)) - ContentRowID(Value(B))
  </code></pre>
  
  <p>Where ContentRowID(Value(A)) means "Find a row the has a given CampaignID, and a ContentRowId of "A" and then get the ContentValue for that row"</p>
  
  <p>Essentially, I have to "pivot" (I think that's the correct term) the rows into columns...</p>
  
  <p>It's an Oracle 10g database...</p>
  
  <p>Any suggestions?</p>