David,

How do I find all the tags that are tagged with the words "mysql" AND "databases" AND "tutorial"?

If there are no url-keyword dupes in tbl_url_keyword ...

SELECT u.urlid, u.url
FROM tbl_url_keyword AS uk
INNER JOIN tbl_url AS u USING (urlid)
INNER JOIN tbl_keywords AS k USING (keywordid)
WHERE k.keyword IN('mysql','databases','tutorials')
GROUP BY u.urlid
HAVING COUNT(*) = 3;

PB

-----

David Otton wrote:
That's a lousy subject line, but I don't know how to describe this problem. 
I've been banging my head against this for a couple of days, and I'm certain 
there's a simple solution I'm missing.

I've got a URL table, a keyword table, and a joining table, so each URL has a 
list of keywords applied to it, and each keyword can be applied to many URLs:

tbl_url
-------

INT urlid,
VARCHAR url

tbl_keyword
-----------

INT keywordid,
VARCHAR keyword

tbl_url_keyword
---------------

INT urlid,
INT keywordid

How do I find all the tags that are tagged with the words "mysql" AND "databases" AND 
"tutorial"?

It seems so simple, I can't believe it's caused me so much grief.





--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.1/369 - Release Date: 6/19/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to