andyw27
asked on
Help with Where clause
Hi,
I’m trying to conduct a SQL statement. I would like to include a LIKE clause. But instead of applying the clause to the entire string I would only like it to compare a portion of the string
For example I have this string:
CS00324522 | test1 / random text1
And from this I need to construct a WHERE statement that would find this:
CS00324522 | test1 / random text2
The | and / characters are common to all strings in the database. However the length of the strings between each of the characters varies with each row.
I guess I need to extract everything to the left of the | characters so the SQL looks like
Where row1 LIKE CS00324522 |
Any ideas if this could be achieved?
I’m trying to conduct a SQL statement. I would like to include a LIKE clause. But instead of applying the clause to the entire string I would only like it to compare a portion of the string
For example I have this string:
CS00324522 | test1 / random text1
And from this I need to construct a WHERE statement that would find this:
CS00324522 | test1 / random text2
The | and / characters are common to all strings in the database. However the length of the strings between each of the characters varies with each row.
I guess I need to extract everything to the left of the | characters so the SQL looks like
Where row1 LIKE CS00324522 |
Any ideas if this could be achieved?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SELECT * FROM myTable WHERE myStrFld LIKE "CS00324522*";
andyw27: Is there a problem?
Hope this helps