Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Atharv
Starting Member
1 Post |
Posted - 2015-02-12 : 02:02:55
|
Hi,This Question is pertaining to AND and OR operators.If we want to retrieve data form a country combined with 3 to 4 cities how do we handle this?Say for ex:- i want to retrieve all data from Customers table where country is Germany and cities are Berlin, Mannheim,Brandenburg and München. Please advice. |
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2015-02-12 : 06:34:46
|
quote: Originally posted by Atharv Hi,This Question is pertaining to AND and OR operators.If we want to retrieve data form a country combined with 3 to 4 cities how do we handle this?Say for ex:- i want to retrieve all data from Customers table where country is Germany and cities are Berlin, Mannheim,Brandenburg and München. Please advice.
You wouldn't need to use OR, instead use IN operator like this:select *from customers cwhere c.country = 'Germany'and c.city IN ('Berlin', 'Mannheim', 'Brandenburg', 'München') |
|
|
|
|
|