Link to home
Start Free TrialLog in
Avatar of pvsbandi
pvsbandiFlag for United States of America

asked on

Query for Last 4 social

I know it's very simple but i'm missing something here..kindly help.
 I have a query like this :
select SUBSTR (CHAR ((DIGITS (ssn_no))), 1, 9) as ssn_no
from  tb_ssn

which works fine.Now the requirement is to get only the last 4 digits of ssn.So, i tried the following and got an error.

select SUBSTR (CHAR ((DIGITS (ssn_no))), 5, 9) as ssn_no
from  tb_ssn

What am i missing? Please advise.
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

try

select right(SUBSTR (CHAR ((DIGITS (ssn_no))), 1, 9) ,4 ) as ssn_no
from  tb_ssn
ASKER CERTIFIED SOLUTION
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pvsbandi

ASKER

Ha--There it is!! Thanks much!
hi
usually i don't do this,
but may i ask why you graded it with B and not A ?