Jump to content

mysql construct to apply multiple fields to a single like


Recommended Posts

Still new.  Off topic - not really php?  Hope not.  Who else knows mysql like the php crowd.

 

I find this clause  construct in many places on this new site:

and t2.keyword like concat('%', :bc11, '%')
 or t2.name    like concat('%', :bc12, '%')
 or t2.des     like concat('%', :bc13, '%')

He's trying to find the search term anywhere in any of the 3 fields.  bc11, bc12 and bc13 are binding 'keys' that receive identical values.  Is there a way to build this something like this:?

and any (t2.keyword, t2.name, t2.des) like concat('%', :bc11, '%')

I had to make up something my self :-).  Thanks.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.