• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

What criteria would I use for my ODBC query

I have an ODBC query pulling my data. One of the columns with data looks has 5 numbers, a slash (/), then 6 more numbers. I need to create criteria for both the 5 numbers before the slash and another criteria for the 6 numbers after the slash. So the data looks like this, 11111/222222. So, I need 2 criterias pulling the same column. One criteria i would put 11111, the other criteria i would put 222222. I thought i would use the function "Like", but that isn't working for some reason. I can't use criteria with Begins With or Ends With. How would i accomplish this??? Thanks!
2 Solutions
In your query you can use the SUBSTRING() function

AND SUBSTRING(column, 1, 5) = '11111'
AND SUBSTRING(column, 6, 6) = '222222'
You should be able to use Like:

column LIKE '11111/%' OR column LIKE '%/222222'
(Have used OR as not sure if AND is correct)
brasimanAuthor Commented:
They actually both work for how i was wanting to use it. Thank you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now