Solved

Help Remove empty space

Posted on 2011-09-14
3
264 Views
Last Modified: 2012-05-12
Hi,

Is there a way to remove any empty space in my ChurchTbl.ChurchName field.

My javascript is not working correct because of empty spaces at the end of the churchName.

some record don't have any empty spaces and some do have.  

I need to check for an empty spaces and remove it .


Thanks,


SELECT CityTbl.CityID, ChurchTbl.ChurchID, ChurchTbl.ChurchName
FROM StateTbl 
LEFT JOIN CityTbl ON CityTbl.StateID = StateTbl.StateID
LEFT JOIN ChurchTbl ON ChurchTbl.ChCityID = CityTbl.CityID
WHERE ChurchTbl.ChurchName <> "null" and ChurchTbl.ChurchStatus = 1
and CityTbl.CityStatus = 1 and StateTbl.StateStatus = 1
and ChurchTbl.ChurchID >=  13773 
order by ChurchTbl.ChurchName ASC

Open in new window

0
Comment
Question by:lulu50
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Cluskitt earned 500 total points
ID: 36536664
You can use the TRIM() function. You can even update the table itself so you don't have to worry about it:
UPDATE ChurchTbl Set ChurchName=TRIM(ChurchName) WHERE LEFT(ChurchName,1)=' ' OR RIGHT(ChurchName,1)=' '
0
 

Author Closing Comment

by:lulu50
ID: 36536809
thanks
0
 
LVL 18

Expert Comment

by:Cluskitt
ID: 36536927
Glad to help
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now