There is a members table, it has username and email fields. It is necessary to fill in the username field with emails, in case it is empty

  • open any book on mysql, look for description of update instructions and where conditions - teran
  • and about the design of IS NULL - Sanek Zhitnik
  • and where it says here that there must be NULL? - Jonny Manowar
  • @JonnyManowar Well, duck and write the question then correctly, and not as horrible. Here, guess what people should, that you have under the Blank is understood. - teran
  • It means that an empty string, why invent? - Jonny Manowar

1 answer 1

update members set username = email where username = ''

  • Is it possible to compare with NULL ?) - Sanek Zhitnik
  • @SanekZhitnik can be compared, but the result will not be the same. - teran
  • The question does not say that the empty field contains exactly null. - Nikolay Torgov
  • one
    To test for NULL, use the IS NULL and IS NOT NULL operators .... You can’t use the manual for the NULL manual - teran
  • @NikolayTorgov in the question is not said. but you yourself meinno with null, and do it wrong. - teran