Non puoi farlo da sql, perchè il distinct lo fa su tutto il campo, quindi "calcio, prova" è diverso da "calcio".
Puoi farlo tramite php:
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;
}
Probabilmente ti stamperà anche un tag vuoto, perchè nel tuo campo hai "calcio, prova,"
(l'ultima virgola dovresti evitarla, comunque puoi intercettare la cosa mettendo :
codice:
if($tag) {
echo $tag;
}
all'interno del foreach.
ciao