如何在 WHERE 子句中使用子字符串?

如何在 WHERE 子句中使用子字符串?

问题描述:

我在 OpenSQL 中的表达是:

My expression in OpenSQL is:

SELECT * FROM  J_1BNFLIN  AS B
  WHERE SUBSTRING(REFKEY , 1 , 10 )

where 子句的子字符串部分不起作用.我做错了什么?

The substring portion of the where clause is not working. What am I doing wrong?

您可以在 WHERE 条件中使用 LIKE.例如:

You can use LIKE in the WHERE condition. For example:

DATA: gv_refkey TYPE j_1bnflin-refkey.
gv_refkey = '123%'.
SELECT *
       INTO TABLE ...
       FROM j_1bnflin
       WHERE refkey LIKE gv_refkey.

这将选择字段 refkey 以 '123' 开头的所有条目(请注意 % 用作通配符)

This will select all entries where the field refkey starts with '123' (pls. note a % is used as wildcard)