I'm trying to build a query that measures "trending" hash tags like tweets. I have a table tweets and a column message (varchar)
Basically I just want to group the messages by a hash tag but it breaks down if there is more than 1 hash tag in the message field, heres what I have so far
SELECT count(message) as count, `message` FROM `tweets` WHERE `message` RLIKE '^#[[:alnum:]]' GROUP BY `tweets`.`message` ORDER BY `count` DESC
which will output the following rows
"4","#sushi"
"3","#coffee"
"3","#wine"
"1","#coffee #park"
"1","#drinking"
"1","#steak"
"1","#pizza"
"1","#pasta"
"1","#food"
The fourth row is the problem where I would want both hash tags totaled on their own, not sure if I can achieve this with just mysql.