I have the following string:
String 1: abcde?dafsdfdsfsd
String 2: absdfcde?dafsdfdsfsdsfdsdfd
Want to remove anything after "?"
Expected output:
String 1: abcde
String 2: absdfcde
Use split_part(), e.g.:
with my_data(col) as (
values
('abcde?dafsdfdsfsd'),
('absdfcde?dafsdfdsfsdsfdsdfd')
)
select split_part(col, '?', 1)
from my_data;
split_part
------------
abcde
absdfcde
(2 rows)