I have a table usertags:
usertags
------------
- usertagid
- usertagsiteid
- usertagtext
I want to select the usertagtext and count of usertagtext grouped by usertagtext. I only want it to show usertagtext that also have a match in the usertagsiteid to a given value for usertagtext.
Not sure if that makes sense so here is an example:
usertagid | usertagsiteid | usertagtext
1 | 1 | 'search'
2 | 1 | 'search engine'
3 | 2 | 'news'
If i feed the query the usertagtext 'search' it should list:
'search engine', 1
If i feed the query the usertagtext 'search engine' it should list:
'search', 1
If i feed the query the usertagtext 'news' it should not return any results.
Here is what I have so far but it doesn't accept the usertagtext input into it:
Let me know if that still doesn't make sense, I'm having a hard time trying to describe it. Hopefully you can figure out what I am looking for based on my examples.Code:SELECT DISTINCT usertagtext, COUNT(usertagtext) AS usertagsum FROM usertags GROUP BY usertagtext ORDER BY usertagsum DESC LIMIT 20










Bookmarks