October 16, 2008 at 10:34 am
I am trying to figure out how to select a specific character from a list of values that I have in a table. For example, my data is configured something like the following:
DESC G/L F100 DESCRIPTION LOCATION
DESC G/L R100 DESCRIPTION LOCATION
DESC G/L B100 DESCRIPTION LOCATION
DESC G/L F135 DESCRIPTION LOCATION
DESC G/L F199 DESCRIPTION LOCATION
I want to select a specific character from the results for example:
WHERE [POSITION 10] = 'F' or WHERE [POSITION 11] BETWEEN 1 AND 5
I know that POSITION is not a recognized function or value for SQL so I was wondering how I could achieve this. Thanks!!
October 16, 2008 at 11:02 am
SELECT *
FROM mytable
WHERE SUBSTRING(mydata,10,1) = 'F' AND SUBSTRING(mydata,11,1) IN ('1','2','3','4','5')
October 16, 2008 at 12:00 pm
Thank you!! This is perfect and worked out great.
Cheers!
Tim
October 16, 2008 at 9:24 pm
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply