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 |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-01-01 : 02:03:46
|
| Hello, good day.If I want to publish the result as depart from parkingA or parkingB or parkingC and arrive from parkingA or parkingB or parkingC where this 3 destination depart or arrive, i will not charge the parking fee.So, should i select like this?select parking.depart in ('pA','pB','pC')ORparking.arrive in ('pA','pB','pC')im not getting the result either depart or arrive from this 3 station. i get result which depart or arrive from other station as well pD,pE,pF,etc...Is my query wrong? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-01 : 02:08:53
|
| [code]select *from tablename herewhere parking.depart in ('pA','pB','pC')ORparking.arrive in ('pA','pB','pC')[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-01-01 : 02:11:59
|
| Thats what i did with my query, but it publish other parking station as well. |
 |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-01-01 : 02:27:33
|
| it works on AND statement. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-01-01 : 02:32:30
|
shouldn't it be a AND condition ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-01-01 : 02:34:42
|
| i tried OR condition but is not working. when i use AND statement is working, it only give the 3 station. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-02 : 12:16:33
|
quote: Originally posted by peace i tried OR condition but is not working. when i use AND statement is working, it only give the 3 station.
sorry your explanation doesnt make sensecan you show with help of sample data what you meant?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|