I have a particular column that needed a cleaning called Owner Address with a table name NashvilleHousing. Below is the example data of the column;
OwnerAddress
-------------
2935 LOUISE DR, NASHVILLE, TN
3019 LOUISE DR, NASHVILLE, TN
3019 LOUISE DR, NASHVILLE, TN
I want to extract NASHVILLE only for every record. My query is as such;
SELECT
SUBSTRING(OwnerAddress, CHARINDEX(',', OwnerAddress)+1, Len(OwnerAddress) - 4)
FROM NashvilleHousing
Where did I go wrong here? Thank you.