我想将城市名称与数据库中的地址分开。
地址有不同的格式,例如
835 street no.3 Jalabad D.I. Khan ................ here city name is D.I khan
Ho. No. 102 St. No. 85 RawalPindi ..........here city name is RawalPindi
h no.944 St. No.74 Karkhana road Gujrat ......here city name is Gujrat
Ho. no.241 S No.26 I-8/3 Isb .........here city name is isb
我正在这样做,但它只适用于少数人......我需要一个适用于每种地址格式的通用查询
SELECT DISTINCT REVERSE
(
LEFT( REVERSE(All_Students.Address), CHARINDEX(' ', REVERSE(All_Students.Address))-1 )
) as Addresses
from All_Students
order by addresses