Ciao ragazzi,ho mandato in esecuzione una query del tipo:
select attr1, count(distinct attr2) as attr3
from nome_tabella
group by attr1
Voglio salvare il risultato di questa query nella mia tabella originaria, per cui ho scritto così:
UPDATE nome_tabella
set attr3= (select attr1, count(distinct attr2) as attr3
group by attr1)
ma viene fuori il seguente errore:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group byattr1)' at line 3
Dove sbaglio? Come posso risolvere?