MySQL Forums
Forum List  »  MySQL Workbench

My SQL do not give me the expected results
Posted by: Craig Smith
Date: November 13, 2020 05:05AM

UPDATE NewGame SET fVal1=0;
Reports that 500 records were affected
This is correct and expected

SELECT f1st1 FROM NewGame;
Selects 500 records
When I Browse NewGame there is clearly a capital letter in each and
every f1st1
This is also correct and expected

But When I then run the following SQL command
It reports that 370 records were affected
and gives me the wrong results

Some times in runs the SQL command twice but not always
I am running the commands in the SQL tab

Why does it report 370 record were affected no matter if it runs once
or twice?
How do I insure the command only runs once?

UPDATE New Game SET fVal1=(CASE
WHEN f1st1='A' THEN fVal1+144 WHEN f1st1='B' THEN fVal1+25
WHEN f1st1='C' THEN fVal1+151 WHEN f1st1='D' THEN fVal1+43
WHEN f1st1='E' THEN fVal1+0 WHEN f1st1='F' THEN fVal1+112
WHEN f1st1='G' THEN fVal1+138 WHEN f1st1='H' THEN fVal1+156
WHEN f1st1='I' THEN fVal1+167 WHEN f1st1='J' THEN fVal1+167
WHEN f1st1='K' THEN fVal1+134 WHEN f1st1='L' THEN fVal1+190
WHEN f1st1='M' THEN fVal1+126 WHEN f1st1='N' THEN fVal1=80
WHEN f1st1='O' THEN fVal1+42 WHEN f1st1='P' THEN fVal1-9
WHEN f1st1='Q' THEN fVal1+68 WHEN f1st1='R' THEN fVal1+166
WHEN f1st1='S' THEN fVal1-14 WHEN f1st1='T' THEN fVal1+113
WHEN f1st1='U' THEN fVal1+188 WHEN f1st1='V' THEN fVal1+182
WHEN f1st1='W' THEN fVal1+143 WHEN f1st1='X' THEN fVal1+190
WHEN f1st1='Y' THEN fVal1+101 WHEN f1st1='Z' THEN fVal1+175
ELSE fVal1 END);

Options: ReplyQuote


Subject
Views
Written By
Posted
My SQL do not give me the expected results
597
November 13, 2020 05:05AM


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.