table
ACC_NO pre_val New_val 123489432 123489432 123489435 123489532 123489532 123489435
I asked some of my friends but not getting how to write the sql query.
bgibtngc1#
Extract the last 4 digits with RIGHT() and concatenate them with the asterisks that replace the first 5 digits.
RIGHT()
SELECT ACC_NO, CONCAT('*****', RIGHT(pre_val, 4)) AS pre_val, CONCAT('*****', RIGHT(new_val, 4)) AS new_val FROM yourTable
31moq8wy2#
Your question is a bit unclear but, I guess you want something like that(?)
SELECT LPAD(RIGHT(ACC_NO, 4),9, "*");
2条答案
按热度按时间bgibtngc1#
Extract the last 4 digits with
RIGHT()
and concatenate them with the asterisks that replace the first 5 digits.31moq8wy2#
Your question is a bit unclear but, I guess you want something like that(?)