[MySQL 5.0.45-community-nt-log] Update multiple rows

Hello my friends, I need your important help.

I tried this join query:

SELECT
	A.password,
        A.email,
	B.email
FROM
	tbl_login A
JOIN tbl_ml B ON A.email = B.email
WHERE
	1
ORDER BY
	ID DESC;

In output I have in the column password of the tbl_login some rows with NULL value.

When the field password of the tbl_login is NULL value I need update NULL value with alphanumeric string random.

Can you help me?
Thanks in advance

One login to one “ml” or one login to many “ml”?

thanks for help. :slight_smile:

solved with this sql update query:

UPDATE tbl_login A
JOIN tbl_ml B ON A.email = B.email
SET A.password = LOWER(
	SUBSTRING(
		(
			CONV(SUBSTRING(RAND(), 3), 10, 36)
		),
		2,
		8
	)
)
WHERE
	1
AND A.password = 'NULL';

This is not correct:

AND A.password = 'NULL';

unless you have the word NULL in the password field. If you mean an actual absence of value NULL then you need

AND A.password IS NULL

You have right my friend… but the rows of the column password are not empty or NULL… have a text string with value NULL … I don’t have database administration … :frowning:

That’s not what you said in your initial post though.