Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Split address by delimer and create new column in MySQL Workbench

I want to split address based on delimeter (,)
extract number from address and split address using (,)

the code i have written select substring_index(Propertyaddress,',') from housingdata;
however it shows an error saying incorrect parameter call to native function
i am using mysql workbench.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

substring_index needs a third parameter.

Try this to get the part before and the part after the comma ,:

select substring_index(Propertyaddress,',', 1),
select substring_index(Propertyaddress,',', -1) 
from housingdata;

substring_index returns a substring from a string before the specified number of occurrences of the delimiter. With 1 as the third parameter, it gets the part of the string before the first encountered comma. With -1 it returns the substring from the right of the last comma.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading