List:General Discussion« Previous MessageNext Message »
From:gerald_clark Date:October 13 2003 1:57pm
Subject:Re: How to search by groups efficiently with MySql 4.0.15?
View as plain text  
A group_id cannot be both 1 AND 3, but it can be  1 OR 3.
Try OR

Jouni Hartikainen wrote:

>
> Hi.
>
>> > how about:
>> >
>> > select record.*
>> > from link
>> > where group_id='x'
>> > left join record on record.archive_id=link.archive_id
>> > ?
>
>
> The problem with this query is that with simple left join, I can 
> search only by a single group.
> If I set x to 3 here, I get all records that belong to group 3. But 
> what about if I want to have all records that belong to groups 1 AND 
> 3? If I add condition "WHERE group_id='1' AND group_id='3'", I get no 
> results at all, since left join doesn't produce such rows that have 
> multiple group_id columns.
>
>
> Sincerely,
>
> Jouni Hartikainen
> kalle_kukkanen@stripped
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
> http://join.msn.com/?page=features/featuredemail
>
>


Thread
How to search by groups efficiently with MySql 4.0.15?Jouni Hartikainen11 Oct
RE: How to search by groups efficiently with MySql 4.0.15?Pakó Géza11 Oct
RE: How to search by groups efficiently with MySql 4.0.15?Jouni Hartikainen12 Oct
  • Re: How to search by groups efficiently with MySql 4.0.15?gerald_clark13 Oct
Re: How to search by groups efficiently with MySql 4.0.15?Jouni Hartikainen15 Oct
  • Re: How to search by groups efficiently with MySql 4.0.15?Roger Baklund15 Oct
Re: How to search by groups efficiently with MySql 4.0.15?Jouni Hartikainen16 Oct