- Home
- Categorie
- Coding e Sistemistica
- Coding
- Classifica post più votati
- 
							
							
							
							
							
Classifica post più votatiIo ho creato un sistema di votazione per ogni post da 1 a 3. Tramite questa query riesco ad estrarre il valore maggiore [PHP]$query = "SELECT SUM(vote),id as somma FROM wp_gdsr_votes_log GROUP BY id ORDER BY somma DESC"; $result = mysql_query($query); list($somma) = mysql_fetch_array($result);print $somma;[/PHP] Il mio problema è che dovrei estrarre i 5 post che ricevono più voti. Come posso risolvere? 
 
- 
							
							
							
							
							
Puoi usare la UNION dove una SELECT ha la somma e la seconda i vari commenti 
 
- 
							
							
							
							
							
Non capisco cosa c'entrano i commenti se devo estrarre la somma dei 5 post più votati?