Do not display the last character

E

EAB1977

Hello. I need to create a query that will take off the last character
if it is a letter.

For example, our database has a unique identifer for each mold of
products. Well, some of these molds were duplicated by using a A, B, C,
and so on. What I need to do is see how many of these molds have a
letter at the end.

Here is my query now:

SELECT Mold0EPS.ProductCode, Mold0EPS.MoldID
FROM Mold0EPS
WHERE (((Mold0EPS.MoldID) Like "*A")) OR (((Mold0EPS.MoldID) Like
"*B")) OR (((Mold0EPS.MoldID) Like "*C"));

Is this the correct way? Or is there a better way?
 
J

John Spencer

Try the following to get the records where MoldID ends in a letter.

SELECT Mold0EPS.ProductCode, Mold0EPS.MoldID
FROM Mold0EPS
WHERE Mold0EPS.MoldID Like "*[A-Z]")
 
A

Adam Turner via AccessMonster.com

EAB1977 said:
Hello. I need to create a query that will take off the last character
if it is a letter.

For example, our database has a unique identifer for each mold of
products. Well, some of these molds were duplicated by using a A, B, C,
and so on. What I need to do is see how many of these molds have a
letter at the end.

Here is my query now:

SELECT Mold0EPS.ProductCode, Mold0EPS.MoldID
FROM Mold0EPS
WHERE (((Mold0EPS.MoldID) Like "*A")) OR (((Mold0EPS.MoldID) Like
"*B")) OR (((Mold0EPS.MoldID) Like "*C"));

Is this the correct way? Or is there a better way?

SELECT Mold0EPS.ProductCode, Mold0EPS.MoldID
FROM Mold0EPS
WHERE RIGHT(Mold0EPS.MoldID, 1) IN ('A', 'B', 'C')

OR

SELECT Mold0EPS.ProductCode, Mold0EPS.MoldID
FROM Mold0EPS
WHERE ISNUMERIC(RIGHT(Mold0EPS.MoldID, 1)) = FALSE
 
Top