0
我在DB一首歌的名字,同时更新,也有DB如何删除重复行而检索数据的
多个重复的行,例如: -
ID - 200 | TAGS - akon
ID - 201 | TAGS - akon
ID - 204 | TAGS - akon
我需要省略重复数据的或删除那些重复的行。
我正在检索数据usings
<?
$result = mysql_query("SELECT * FROM tags WHERE tag !='' ORDER by id DESC LIMIT 30");
while($row = mysql_fetch_array($result)) {
$title = str_replace('-',' ',$row['tag']);
if (strlen($title) > 50)
$title = substr($title, 0, strrpos(substr($title, 0, 50), ' ')) . '...';
$title = str_replace('---','-',$title);
$title = str_replace('--','-',$title);
$tag = str_replace('---','-',$row['tag']);
$tag = str_replace('--','-',$tag);
echo "<a href=/mp3/".UrlText($tag)."/ title=\"".$title." \">".$title . " </a> :: ";
}
?>
我需要省略或删除那些重复的行,只显示独特的内容
如何从db中删除那些重复的行 – azarudeen 2014-08-30 18:03:23
+1区别不需要或使用括号。幸运的是,'(col1)'与'col1'相同。 SQL标准不等于运算符是'<>',而不是'!=',尽管它们都在MySQL中工作。 – Andomar 2014-08-30 18:05:02
@ user3663603:请参阅http://stackoverflow.com/questions/3311903/remove-duplicate-rows-in-mysql – Andomar 2014-08-30 18:05:48