Jump to content
Sign in to follow this  
Prodjex

MYSQL MySQL Trim

Recommended Posts

I have a column within my MySQL table that holds city and states for records.

The dataset looks like the following:

Clay County, AL  
Cleburne County, AL
Coffee County, AL
Colbert County, AL                    
Conecuh County, AL                   
Coosa County, AL                 
Covington County, AL

I need to just select the state name for all of the records.  Since I know this is not user input and the data is all clean/structured as above I can trim off what I don’t need with the following command:

select right(trim(cityStateField), 2);

This then returns the needed results with just the state abbreviation:

AL
AL
AL
AL
AL
AL
AL

The post MySQL Trim appeared first on Kansas City Web Consulting | Kansas City Web Development.

View the full article

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...