Remove leading comma in Places
Quote from Tom Holden on 2022-10-26, 9:13 amEd Bell posted this question in a comment on Places: Delete Unused:
I have a lot of Places that have leading commas:
", Abbeville, South Carolina, United States"
I want to remove the leading commas.
Anyone?
Ed Bell posted this question in a comment on Places: Delete Unused:
I have a lot of Places that have leading commas:
", Abbeville, South Carolina, United States"
I want to remove the leading commas.
Anyone?
Quote from Tom Holden on 2022-10-26, 12:06 pmThis seems to work:
-- List Place Names having a comma preceding the name with any number
-- of space characters around the comma
SELECT Name, TRIM(SUBSTR(TRIM(Name),2)) FROM PlaceTable
WHERE TRIM(Name) LIKE ',%'
;-- Update Place Names to remove the leading comma and adjacent space characters
-- Repeat for multiple leading commas
UPDATE PlaceTable
SET Name = TRIM(SUBSTR(TRIM(Name),2))
WHERE TRIM(Name) LIKE ',%'
;For reference, see Search & Replace.
This seems to work:
-- List Place Names having a comma preceding the name with any number
-- of space characters around the comma
SELECT Name, TRIM(SUBSTR(TRIM(Name),2)) FROM PlaceTable
WHERE TRIM(Name) LIKE ',%'
;-- Update Place Names to remove the leading comma and adjacent space characters
-- Repeat for multiple leading commas
UPDATE PlaceTable
SET Name = TRIM(SUBSTR(TRIM(Name),2))
WHERE TRIM(Name) LIKE ',%'
;
For reference, see Search & Replace.