title: sql join statement and deliberately repeat first line in every group
body: <p>I have Header and Detail file (such as an invoice header and invoice detail)</p>
  
  <pre><code>SELECT InvH, Line FROM InvHed join InvDet on (invH = invD) where VoidLine = ''
  </code></pre>
  
  <p>Normally when you join these together you get a list like this:</p>
  
  <pre><code>Invoice  Line
  123456    2
  123456    3
  123456    4
  123456    6
  123457    1
  123457    2
  123457    3
  </code></pre>
  
  <p>Note that first detail line may not be coded as 1. Here it happens  to be 2.</p>
  
  <p>I would actually like to structure an SQL statement such that the first detail line would repeat. </p>
  
  <pre><code>Invoice  Line
  123456    2
  123456    2
  123456    3
  123456    4
  123456    6
  123457    1
  123457    1
  123457    2
  123457    3
  </code></pre>
  
  <p>Results should be sorted on Invoice/Line (added)</p>