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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Ranges with Modifiers

Author  Topic 

jjame47
Starting Member

1 Post

Posted - 2014-10-27 : 15:07:42
I'm trying to write a statement that will return all records within a range. The only problem is that the records can have modifiers on them.

For example, a sample range I would want would be all records between 1008 and 1120. I can't use a between statement though because these records can end in modifiers, like 1009X or 1117B.

How can I search for records within a range when they have modifiers such as above? Thanks!

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2014-10-27 : 18:11:15
[code]select *
from yourtable
where left(yourfield,length(yourfield)-1) between '1008' and '1120'
[/code]
Go to Top of Page
   

- Advertisement -