I have this type of string in the field of my table.
type_no
2345-ABC-3210002478
and I want to select only the last 10 digits number of the string, I expect it would be:
type_no_id
3210002478
how can I do this in PostgreSQL?
Thanks in advance
CodePudding user response:
Use RIGHT() for getting desired output.
SELECT RIGHT('2345-ABC-3210002478', 10) type_no_id
If using column of a table then follow the below example
create table test (type_no varchar(100));
insert into test values ('2345-ABC-3210002478');
SELECT RIGHT(type_no, 10) type_no_id
FROM test