sql 把一个字段按照某个字符分割成三个字段 SUBSTRING_INDEX

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

SELECT
	SUBSTRING_INDEX(address, ' ', 1) AS '省',
	SUBSTRING_INDEX(SUBSTRING_INDEX(address, ' ', 2), ' ', -1) AS '市',
	SUBSTRING_INDEX(SUBSTRING_INDEX(address, ' ', 3), ' ', -1) AS '区',
	addressdetail,
FROM
	address

转载于:https://my.oschina.net/shmilyle/blog/1927208

你可能感兴趣的:(sql 把一个字段按照某个字符分割成三个字段 SUBSTRING_INDEX)