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 |
|
rnbguy
Constraint Violating Yak Guru
293 Posts |
Posted - 2007-04-19 : 20:18:48
|
| is there a way to have a select statement which compares a value is like ('%a%','%b%','%c%','%d%','%f%','%l%')so :select address from customerswhere address like ('%a%','%b%','%c%','%d%','%f%','%l%')??? |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-04-19 : 20:48:09
|
| if you really are checking for a single letter, as in your example, then all you need is:select addressfrom customerswhere address like '%[abcdfl]%'if you are looking for patterns of multiple letters, then you must use OR:select addressfrom customerswhere address like '%abc%' or address like '%def%' or ..... etc ...- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
rnbguy
Constraint Violating Yak Guru
293 Posts |
Posted - 2007-04-19 : 21:01:12
|
| damn :(thanx anyway |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-04-19 : 21:16:28
|
| Why does it matter if you do it as an OR instead of what you have just written? |
 |
|
|
rnbguy
Constraint Violating Yak Guru
293 Posts |
Posted - 2007-04-19 : 21:25:04
|
| because what we've done is added all those values to another tablesso now its pretty impossible because we'd have to compare address contains a value from another tablesounds bit confusing, did that make sense? |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-04-20 : 01:20:25
|
| If I understand what you have done you can just join to that other table.select address from customersinner join other_table oncustomers.address like other_table.address_bit+'%'assuming your other table containsaddress_bit-----------abcd |
 |
|
|
rnbguy
Constraint Violating Yak Guru
293 Posts |
Posted - 2007-04-20 : 02:56:38
|
| done deal |
 |
|
|
|
|
|
|
|