I have a mysql table comments in that table a field is tags and all tags are comma separated like
Comments Table
Name Reply Tags
a b new,old,facebook,fb
b d water,faebook,wall
b r wall,php,fb
c q name,facebook,email
a y weather,cold,old
a w twitter,next,pet,fb
I need to get most used tag in this table with mysql query..
I think that the best approach is to use a separate table for Tags and for the relation between Tags and your table (i.e.: CommentTags), it'll allow you to quickly find those comments that use any speciffic tag, do statistics, etc. With your current approach, you end up using a string splitting for each row, each time.
Now, if you are stuck with your current approach, here is a question about string splitting that you may find useful. But I foresee a great deal of performance complains by users...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With