MySQL - Trim in Where clause

Can you use the trim function in the where clause? For example:

SELECT * from resv where trim(street) = 'Maple'.

The table may have like ' Maple' or 'Maple '.

Or maybe just

SELECT * frpm resv where street like '%Maple%'

Would that work?

The problem I see with that is I don't want a match of 'Maple Street'
Richard KortsBusiness Owner / Chief DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
From http://dev.mysql.com/doc/refman/5.0/en/select.html :

In the WHERE expression, you can use any of the functions and operators that MySQL supports, except for aggregate (summary) functions. See Section 8.5, “Expression Syntax”, and Chapter 11, Functions and Operators.

You would have to look up the details of what that means because I'm not certain you can do exactly what you have posted.  The easiest thing is to try it and see it works or causes an error.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard KortsBusiness Owner / Chief DeveloperAuthor Commented:
I went ahead & tried it (in a php script),

It runs without error.

Thanks!
0
Dave BaldwinFixer of ProblemsCommented:
You're welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.