title: netezza nzsql/SQL: How to do limit or top in update statement?
body: <p>I´m trying to execute following statement:</p>
  
  <pre><code>UPDATE refixy_zakladni_tabulka
  SET u_Marketingova_akce_vysledek_bit = dbo.Data_Marketingove_akce.Výsledek
  FROM dbo.Data_Marketingove_akce
  WHERE dbo.Data_Marketingove_akce.CisloSluzby = dbo.Refixy_Zakladni_tabulka.u_Sluzba AND
  (dbo.Refixy_Zakladni_tabulka.u_Cas_Refixace_datum BETWEEN
  dbo.Data_Marketingove_akce.Cas_Refixace_datum_od
  AND dbo.Data_Marketingove_akce.Cas_Refixace_datum_do) 
  </code></pre>
  
  <p>The result is canceled update due to attemp to update a target row with multiple join rows. I understand that the WHERE clause may return multiple records so it is impossible to update. But if this occurs, I only need first record that meet the WHERE clause, so I would like to use TOP or LIMIT to do so. Unfortunately TOP is no use in UPDATE statement and my attemps to add LIMIT to the statement fails with: </p>
  
  <blockquote>
    <p>found "LIMIT" (at char 389) expecting a keyword</p>
  </blockquote>
  
  <p>Complete statement with limit clause looks like this:</p>
  
  <pre><code>UPDATE refixy_zakladni_tabulka
  SET u_Marketingova_akce_vysledek_bit = dbo.Data_Marketingove_akce.Výsledek
  FROM dbo.Data_Marketingove_akce
  WHERE dbo.Data_Marketingove_akce.CisloSluzby = dbo.Refixy_Zakladni_tabulka.u_Sluzba AND
  (dbo.Refixy_Zakladni_tabulka.u_Cas_Refixace_datum BETWEEN
  dbo.Data_Marketingove_akce.Cas_Refixace_datum_od
  AND dbo.Data_Marketingove_akce.Cas_Refixace_datum_do) LIMIT 1
  </code></pre>
  
  <p>How can I make this work? </p>
  
  <p>Thanks for any help.</p>