Connecting Tech Pros Worldwide Forums | Help | Site Map

Search Query....help needed!

Member
 
Join Date: Feb 2009
Posts: 57
#1: Jun 15 '09
Hi,
I have a query where i have to filter some conditions.
I am trying out for a query where i have to include the combinations (1,1) and (0,-1) but i need to exclude the combination (0,1).

So let say A can be either 0 or 1 but B can be in (-1,1)....it will give me all the combinations say (1,1), (0,1) and (0,-1).But i want to exclude (0,1).

Can anyone please help how can i do this??

Thanks in advance,
Lauren

Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,751
#2: Jun 15 '09

re: Search Query....help needed!


Hi.

You just need to be more specific with your WHERE clause.

The description you just gave us is exactly what you should be writing into the query:

Quote:
where i have to include the combinations (1,1) and (0,-1) but i need to exclude the combination (0,1)
Which translates to:
Expand|Select|Wrap|Line Numbers
  1. WHERE  (`a` IN(1, 0) AND `b` IN(1, -1))
  2. AND NOT(`a` = 0 AND `b` = 1);
Member
 
Join Date: Feb 2009
Posts: 57
#3: Jun 15 '09

re: Search Query....help needed!


Thanks a lot for your precious reply.
Reply


Similar MySQL Database bytes