[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: searching in an 'AND' style of query
From:       starmonkey <starmonkey () evolove ! net>
Date:       2006-02-28 5:54:14
Message-ID: 20060228170645.4873olp5w0o8cwck () www ! evolove ! net
[Download RAW message or body]

Quoting Chris <listschris@leftbrained.org>:
> SELECT content.name
> FROM content as c
> INNER JOIN content_categories as cg
>  ON(c.id = cg.content_id)
> INNER JOIN categories as g
>  ON(cg.category_id = g.id)
> WHERE g.id IN (3,5,9)
> GROUP BY c.id
> HAVING 3 = COUNT(*)

Thanks, Chris - that did the trick alright! I use PHP to make the query 
dynamic, and now I can "drill down" into my content by selecting 
categories in an AND fashion.

cheers!
sm

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic