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 |
|
samwise
Starting Member
7 Posts |
Posted - 2005-10-26 : 09:45:32
|
| Hi,How do i write a query in which i want to retrieve all the phone numbers beginning with 20 except for 201 (i need 200,202,203 etc')Sorry if the question sounds dumb but i can't find the right syntax.Thanks, |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-10-26 : 09:56:02
|
where phoneNum like '20[^1]%'Go with the flow & have fun! Else fight the flow |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-26 : 09:57:44
|
| Select columns from yourTable where phoneNo like '20%' and phoneNo <>201MadhivananFailing to plan is Planning to fail |
 |
|
|
samwise
Starting Member
7 Posts |
Posted - 2005-10-26 : 11:30:12
|
didn't work.had to use REGEXP '^20[^1](1)*'thanks anywayquote: Originally posted by spirit1 where phoneNum like '20[^1]%'Go with the flow & have fun! Else fight the flow 
|
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-10-26 : 11:44:15
|
what do you mean it didn't work?this select 10250 - 10259, without selecting 10251. isn't that what you wanted??use northwindselect * from orderswhere orderid like '1025[^1]%' Go with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|