Multiple conditions in a where clause

omgjtt

Registered User.
Local time
Today, 12:27
Joined
May 27, 2011
Messages
22
I am trying to write a query that will only return result from 3 different countries (Ireland, Germany, and Spain) from a table that contains 100's of different countries.

Here is the query I wrote that does not seem to be working.

Code:
Select bbc.name, bbc.population
from bbc
Where name='France','Germany','Spain'

My question is how do I write a where clause with more than one condition. Should I use 'OR' or 'AND'

Thanks in advance

-James
 
You'd want OR

Where name='France' OR name= 'Germany' OR name= 'Spain'

Or you can use an IN() clause:

Where name IN('France','Germany','Spain')
 
Change this

Select bbc.name, bbc.population
from bbc
Where name='France','Germany','Spain'

to this
Select bbc.name, bbc.population
from bbc
Where name IN ('France','Germany','Spain')

But you should be aware that Name may have special meaning in Access.

For reference check these terms that you should avoid in your naming
http://allenbrowne.com/AppIssueBadWord.html
 
Thanks for the help and additional advice.
 

Users who are viewing this thread

Back
Top Bottom