MySQL Forums
Forum List  »  Newbie

Re: MySQL Update query not giving expected result
Posted by: Peter Brawley
Date: April 11, 2022 01:48PM

To debug such an issue, create a select statement that lays out the values relevant to the update ...

  a.Parsreels_Suiker, b.aangepas, a.datum,
  b.datumaangepas,  b.suiker_onder_aangepas,
  b.DatumAangepas2, b.Suiker_onder_Aangepas2, 
    When b.Aangepas = 'JA' AND a.Datum >= b.DatumAangepas THEN b.Suiker_onder_Aangepas  
    When b.Aangepas2 = 'JA' AND a.Datum >= b.DatumAangepas2 THEN b.Suiker_onder_Aangepas2  
    ELSE  Suiker_onder  
  End as UPDVAL
FROM penalisasietrash a 
JOIN parsreelstrash As b On a.Kult = b.Kultivar And a.KlasBeskrywing = b.Klasbeskrywing;

... then check the results of your query logic row by row .

Options: ReplyQuote

Written By
Re: MySQL Update query not giving expected result
April 11, 2022 01:48PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.