用MySQL上的逗号分隔字段计算流行标签 [英] Count popular tags with comma delimited field on MySQL

查看:133
本文介绍了用MySQL上的逗号分隔字段计算流行标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌子上有一个逗号分隔的字段,它存储诸如以下标签:

I have a comma delimited field on my table, it stores Tags like:

avengers, heroes, marvel, 2012, hulk, captain america

我想获得最常用的标签.

And i want to get the most used tags.

如何对一个SELECT查询执行此操作?

How can i do this on one single SELECT query?

推荐答案

您不能-MySQL不提供用于拆分字符串的功能.您需要规范化数据以在纯SQL中实现此目标.

You can't - MySQL does not provide a function to split strings, for one thing. You need to normalize your data to achieve this in pure SQL.

这篇关于用MySQL上的逗号分隔字段计算流行标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆