84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
现在有一张表list,其中有个字段是tags,每次添加新的文章时候,会向字段中存入类似 女生,玄幻,奇幻等标签词语。现在想查询出这张表中存在的所有的标签(每个只出现一次),不经过程序过滤,请问用mysql怎么实现呢?
女生,玄幻,奇幻
我试过:
SELECT DISTINCT(tags) FROM list;
list
不行,这样查询出来的只是字段的所有内容,而我想要的则是这张表中的所有tags标签名,并且每个只出现一次。
求解,谢谢。
欢迎选择我的课程,让我们一起见证您的进步~~
SELECT DISTINCT(tags) FROM list where locate(',',tags) = 0; //分割使用的是,?
SELECT tags FROM list group by tags;
How about this
select group_concat(distinct tags) from list;
The questioner probably wants to split the tags field and then aggregate it. There is a mysql split function http://www.cnblogs.com/bojuet...
SELECT tags FROM list group by tags;
How about this
select group_concat(distinct tags) from list;
The questioner probably wants to split the tags field and then aggregate it.
There is a mysql split function
http://www.cnblogs.com/bojuet...