title: update first line of table in Postgres
body: <p>I have two tables:</p>
  
  <p><code>Corresp</code> which have this columns: <code>idCorresp, textCorresp ,dateCorresp</code><br/>
  <code>Trans</code> which have this columns: <code>idTransf , textTransf, dateTransf,idCorresp</code></p>
  
  <p>this is an example of data:</p>
  
  <p><strong>Corresp</strong>:  </p>
  
  <pre>
  001, testCorresp, 01/01/2014
  </pre>
  
  <p><strong>Trans</strong></p>
  
  <pre>
  1 , T1, 01/01/2013, 001
  2 , T2, 01/02/2013, 001
  3 , T3, 01/03/2013, 001
  </pre>
  
  <p>I want to develop a query with postgres to modify just the first line of the table <code>trans</code>  which is related to the table <code>corresp</code></p>
  
  <p>so make <code>textCorresp</code>  of <code>Corresp</code>  in this column : <code>textTransf</code> of the first line of Trans`</p>
  
  <p>I try without success  with:</p>
  
  <pre><code>update Trans trans
  set textTransf= (
  select corresp.textCorresp 
  from Corresp corresp , Trans trans
  where corresp.idCorresp= trans.idCorresp
  )
  from Corresp corresp , Trans trans
  where corresp.idCorresp= trans.idCorresp
  and trans.dateTransf=(select min(trans.dateTransf) 
  from Corresp corresp , Trans trans
  where corresp.idCorresp= trans.idCorresp)
  </code></pre>
  
  <p>as a result after running my query I want to have this result in <code>Trans</code></p>
  
  <pre>
  1 , testCorresp, 01/01/2013, 001
  2 , T2, 01/02/2013, 001
  3 , T3, 01/03/2013, 001
  </pre>
  
  <p>I try also with :</p>
  
  <pre>
  update Trans trans3
      set textTransf= 
  textCorresp 
  from 
  (
  select Corresp .textCorresp ,  min(trans.dateTransf)   
  from Trans trans , Corresp corresp, Trans trans2
  where corresp.idCorresp= trans.idCorresp
  and corresp.idCorresp= trans2.idCorresp
  group by 
  corresp.textCorresp ,trans.dateTransf
  )as toto
  
  WHERE  trans3.idTransf = toto.idTransf 
  </pre>