MySQL Forums
Forum List  »  Italian

Re: Query help:selezionare gruppi in base al valore degli elementi
Posted by: Gavin Towey
Date: April 20, 2011 04:40PM

Non so essatamente che cosa tu vuoi. Uso del GROUP BY significa che tutti i records che hanno il stesso valore, saranno uniti in una riga singola. Così du devi precisare come fare questo:
Per la maggior parte, questo è facile. Devi usare un funzione come quelli:
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html


Forse qualcosa come:
SELECT nazionalità, COUNT(*) FROM customers WHERE status!='sposato' GROUP BY nazionalità;

Non includere le altre colonne, perchè non hanno senso in questo tipo di query.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Query help:selezionare gruppi in base al valore degli elementi
1484
April 20, 2011 04:40PM


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.