Answer the question
In order to leave comments, you need to log in
How to correctly split a postal address into elements in MySQL?
Hello, I can’t figure out how to correctly atomize the mailing address through substring_index.
There is a line:
Arkhangelsk, st. Mayakovsky, d. 45
We select the street:
concat(substring_index(substring_index(substring_index(`houseProfile`.`adressHouse`,',',2),',',-(1)),' ',-(1)),' ',substring_index(substring_index(substring_index(`houseProfile`.`adressHouse`,',',2),',',-(1)),'.',1)) AS `улица`,
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `test`
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`adress` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of test
-- ----------------------------
INSERT INTO `test` VALUES ('г. Архангельск, ул. Полярная, д. 32');
INSERT INTO `test` VALUES ('г. Архангельск, ул. Советская, д. 22');
INSERT INTO `test` VALUES ('г. Архангельск, ул. Беломорской флотилии, д. 13');
INSERT INTO `test` VALUES ('г. Архангельск, ул. Терпких игрыстых вин, д. 13');
INSERT INTO `test` VALUES ('г. Архангельск, ул. тут-просто тест-такой, д. 13');
Answer the question
In order to leave comments, you need to log in
Damn, this question has already been, but the answer has not been received:
https://toster.ru/q/260915
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question