Just to clarify, here is some more info:

Here is what the query looks like:

SELECT DISTINCT `entries`.id FROM `entries` LEFT OUTER JOIN `entries_tags`
ON `entries_tags`.entry_id = `entries`.id LEFT OUTER JOIN `tags` ON
`tags`.id = `entries_tags`.tag_id WHERE (`entries_tags`.tag_id IN (5,6));

So in this instance, what I'm looking for are the entries where they have
two entries in entries_tags with tag ids 5 and 6, instead of entries that
have either.

Thanks again,

Simon

On 27 September 2011 09:46, Simon Wilkinson <simon.wilkin...@gmail.com>wrote:

> Hi,
>
> I have a query where I'm using a left outer join to connect two tables,
> entries and entries_tags, where entries_tags is a join table between entries
> and another table, tags.  In my query I am selecting values from the entries
> table where the entries have any of the provided tags - WHERE
> entries_tags.tag_id IN (x, y, z)
>
> What I would like to do is switch this from an OR condition to an AND
> condition, so that an entry is only returned if it has all of x, y, and z.
>
> How would I go about doing this?
>
> Thanks,
>
> Simon
>
>
>

Reply via email to