开发者

DB2 SELECT using alpha wildcard and the length of 4 characters

I need to do a SELECT for a product_id where the length the product_id is 4 characters long and the last character can be any letter. I know the wildcard for selecting any letters but I don't know how to denote that it has to be the last character and that the product_ids I'm looking for must be开发者_StackOverflow 4 characters long.

Does that make sense?


Have you tried RIGHT and standard LIKE? (There is a LEFT in DB2). If not, SUBSTR.

In DB2 you can use LENGTH

So hopefully

WHERE
    RIGHT(product_id, 1) LIKE [A-Z] AND LEN(product_id) = 4
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜