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 |
|
alperozgur
Starting Member
16 Posts |
Posted - 2004-05-18 : 10:20:32
|
| I need to use two where clause in a select. i tried lots of ways but can not find a solution. Please help mehere is the querySELECT ANAL_M6, VALUE_4, ANAL_M2, TRANS_REFFROM SOMFDETBPTINNER JOIN SSRFADD D ON ANAL_M6=ADD_CODE AND D.SUN_DB='BPT'INNER JOIN SSRFADB B ON ANAL_M6=ADB_CODE AND B.SUN_DB='BPT'INNER JOIN SSRFADB E ON ANAL_M6=B.ADB_CODE AND E.SUN_DB='BPT'INNER JOIN SSRFANV A (NOLOCK) ON A.CODE=B.ANAL_C4INNER JOIN SSRFANV C ON C.CODE=B.ANAL_C2 AND A.SUN_DB='BPT' AND C.SUN_DB='BPT'AND A.CATEGORY='C4' AND C.CATEGORY='C2'here is the where clauses :WHERE B.ANAL_C4='2' AND ANAL_M6 IN ('MA0080','MA0061','MA0013','MA0012')WHERE B.ANAL_C4='1' AND SUBSTRING(ANAL_M6,3,1)='MA0' |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-05-18 : 10:27:11
|
| WHERE (B.ANAL_C4='2' AND ANAL_M6 IN ('MA0080','MA0061','MA0013','MA0012'))OR (B.ANAL_C4='1' AND SUBSTRING(ANAL_M6,3,1)='MA0')note the use of the OR construct....you may need to make this an AND if the business logic requires it. |
 |
|
|
TurdSpatulaWarrior
Starting Member
36 Posts |
Posted - 2004-05-18 : 10:44:04
|
| Interesting column names |
 |
|
|
|
|
|