例如,我有一个字符串“ some_random_string_first:random_string_that_i_ignore_during_query:some_random_string_second
”。
我想在这里
some_random_string_first
和 some_random_string_second
仅使用 JPA SUBSTRING 的字符串。
我尝试使用 JPQL 的 SUBSTRING ,但是它仅从索引和
开始因为我的
some_random_string_first
和some_random_string_second
可以是任意长度,我无法写出实际长度。
使用mysql我可以使用
SUBSTRING_INDEX("some_random_string_first:random_string_that_i_ignore_during_query:some_random_string_second", ".", 1)
和
SUBSTRING_INDEX("some_random_string_first:random_string_that_i_ignore_during_query:some_random_string_second", ".", -1)
但同样,我无法通过 JPA 复制。
期望的答案是some_random_string_first
和some_random_string_second
,我稍后会 concat 。