UPDATE 'tabela' SET 'Relacionar_A' =
(SELECT 'Relacionar_A' FROM 'tabela' WHERE 'Relacionar_A'='' ORDER BY RAND() LIMIT 2)
I can only do% single , only 1 record from update
.
What I would like - and that I did not get a look for (probably did not use the best keywords for this I am here) - is to know how I can make a select
multiple, from several records from this my update
.
The idea is to sort contacts and choose the number of contacts to be drawn and the person to whom this contact will be related.
To sort out I use:
SELECT * FROM 'tabela' WHERE 'Relacionado_A'='' ORDER BY RAND() LIMIT $tQuantidade
And make select
of all those random records at once with Related Person to these records.