Non puoi farlo da sql, perchè il distinct lo fa su tutto il campo, quindi "calcio, prova" è diverso da "calcio".
Puoi farlo tramite php:
Probabilmente ti stamperà anche un tag vuoto, perchè nel tuo campo hai "calcio, prova,"codice:$s="SELECT DISTINCT tag FROM $table WHERE attiva='si' ORDER BY data_ins DESC LIMIT 0,10"; $r=mysql_query($s); $tags = array(); while($d=mysql_fetch_array($r)){ $tags = array_merge($tags, explode(",",$d['tag'])); } $tags = array_unique($tags); foreach($tags as $tag) { echo $tag; }
(l'ultima virgola dovresti evitarla, comunque puoi intercettare la cosa mettendo :
all'interno del foreach.codice:if($tag) { echo $tag; }
ciao

Rispondi quotando