sql中的reverse功能有哪些?
要把用户电话号码中,倒数第三位是2,倒数第二位是6,最后一位是偶数的号码列出来
declare @tab table(tel varchar(50))
insert @tab values('13455555555')
insert @tab values('13455555266')
insert @tab values('13455555557')
insert @tab values('13455555258')
insert @tab values('13455555269')
select * from @tab where substring(REVERSE(tel),3,1)=2
select * from @tab where substring(REVERSE(tel),3,1)=2 and substring(REVERSE(tel),2,1)=6
select * from @tab where substring(REVERSE(tel),3,1)=2 and substring(REVERSE(tel),2,1)=6
and substring(REVERSE(tel),1,1)%2=0
REVERSE
能把一个字符串倒过来
本文地址:http://www.45fan.com/a/question/71099.html