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 |
|
Neon
Starting Member
13 Posts |
Posted - 2012-01-19 : 21:13:45
|
| hi allfirst off i'll display examplei have a table similar to thisID, TYPEID, VAL1, VAL21 1 4 22 1 2 3 3 2 3 44 2 4 55 1 3 26 1 3 57 3 5 1ie, User input - TypeID 1,2 - VAL1 = 4 - VAL2 = 5i need to select Type1 using VAL1 data Only, but VAL1 and VAL2 for TypeID 2giving result ofID, TYPEID, VAL1, VAL21 1 4 24 2 4 56 1 4 3can this be done? thanks |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-01-20 : 13:29:51
|
Maybe something like this?:SELECT *FROM TableWHERE( TypeID = 1 AND Val1 = 4)OR( TypeID = 2 AND ( Val1 = 5 OR Val2 = 5 )) |
 |
|
|
|
|
|