MySQL Forums
Forum List  »  Newbie

Re: Update column2 on all lines automatically to Y, when column1 is unique and column2 is N
Posted by: Jose Almeida
Date: June 21, 2018 09:58AM

Hi PB,

Thank you for the advice.

Here it goes:
UPDATE tabela_users set flgd_users = 'Y' WHERE enti_users = (SELECT DISTINCT enti_users)

This one was a disaster.
Has updated all enti_users column, on all lines, to Y....
I thought it would update only the ones UNIQUE.

This was not at all, what I was looking for and will bring me a lof of extra manual work because I had aleady manually updated a lot of non unique lines.

Now I must update back all columns to N with the same above sentence.

And look for a different sentence.

Thanks again,
JA

Options: ReplyQuote




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.