On 1/11/06, Gordon Bruce <[EMAIL PROTECTED]> wrote:
> I assume you are looking for both red and car.
> You can not use IN because that is implicitly an IN.
> You hae to join the tags table to itself using 2 different aliasis.
> {If you required 3 things then you would join it 3 times etc..}
>
> SELECT *
> FROM   pics
>        INNER JOIN tags AS t1
>        ON (pics.picid=t1.picid
>            AND t1.tag = 'Car'
>            )
>        INNER JOIN tags AS t2
>        ON (pics.picid=t2.picid
>            AND t2.tag = 'Red'
>            )
>

Brilliant!

Not only does it work but I can easily piece it together for multiple tags.

Thanks!
MikeMartin

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

Reply via email to