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 |
kt
Yak Posting Veteran
88 Posts |
Posted - 2014-11-04 : 15:19:07
|
I have the table with this format Q09Qv9WC8KT78QH2QB2UO0I want the query to get only the values that start with Q and third characters are in 9 and 2, so the results will show belowQ09Qv9QH2QB2select * from tblwhere vOrder like 'Q%' and (SUBSTRING(LTRIM(vOrder ),1,3) in ('3')) and (SUBSTRING(LTRIM(vOrder ),1,3) in ('5'))Can anyone plz help? |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-04 : 16:01:39
|
Select * from tblwhere vOrder like 'Q_9' or vOrder like 'Q_2'basically, ignore the second character. |
|
|
kt
Yak Posting Veteran
88 Posts |
Posted - 2014-11-04 : 16:06:15
|
Thank you |
|
|
|
|
|