sam2929
asked on
filter only by one character
Hi ,
I have data as below
mary
john simpson
L
P
KAMRA
I want result like
L
P
Thanks
I have data as below
mary
john simpson
L
P
KAMRA
I want result like
L
P
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm not really clear. What, exactly, are you trying to accomplish?
For all columns with only one character -
select column from yourtable where length(column) = 1
For all columns starting with 'L' or 'P' -
select column from yourtable where substr(column,1,1) in ('L','P')
For all columns where the column value is 'L' or 'P'
select column from yourtable where length(column) = 1 and column in ('L','P')
select column from yourtable where length(column) = 1
For all columns starting with 'L' or 'P' -
select column from yourtable where substr(column,1,1) in ('L','P')
For all columns where the column value is 'L' or 'P'
select column from yourtable where length(column) = 1 and column in ('L','P')
If you're only looking for one-character values in your column, then the trim function is unnecessary.