[英]How can I find a Substring in an SQl-Query=
select * from "ParaListen" where Auftrag='235829/PAOrtsA'
How can I find a certain "Substring" in an Pervasive-statement?如何在 Pervasive-statement 中找到某个“子字符串”?
Select select * from "ParaListen" where substr(Auftrag,8,?)='PAOrtsA'
I mean: which function shows the rest of the string after the "/" character?我的意思是:哪个 function 在“/”字符之后显示字符串的 rest?
Rather than substring
, I would suggest the right
function.我建议使用
right
的 function 而不是substring
。 With right
, you can use the position
or locate
function to get the position of the '/'
and get the rest of the string without needing to know the length of the remaining string. With
right
, you can use the position
or locate
function to get the position of the '/'
and get the rest of the string without needing to know the length of the remaining string. Something like:就像是:
create table ParaListen1
(f1 char(100),
auftrag char(14));
insert into ParaListen1
(f1, auftrag) values ('235829/PAOrtsA', '235829/PAOrtsA');
insert into ParaListen1
(f1, auftrag) values ('235829/PAOrtsB', '235829/PAOrtsB');
select position('/',auftrag),locate('/',auftrag), f1, auftrag from "ParaListen1"
where right(Auftrag,position('/',auftrag))='PAOrtsA'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.