- SQL code
SELECT client_address FROM T_Client_Info
这条查询语句查出的结果是:
========================
client_address
XX街-XX楼-XX门
YY街-YY楼-
.
.
.
.
等等。。。
========================
我想得到的结果:
========================
client_address
XX街-XX楼-XX门
YY街-YY楼
.
.
.
.
等等。。。
========================
(如果“client_address ”最后一个char是"-"那么 只要前边的char)
------解决方案--------------------
- SQL code
SELECT case when right(client_address,1)='-' then left(client_address,len(client_address)-1)else client_address end FROM T_Client_Info