Jump to content

Recommended Posts

Hi folks, hope you can help with this one

 

Imagine I have a database which contains details of where a person was born, where they went to school, where they went to college and where they now live and where they now work.  The table might look like this :

 

name            born                school          college            live                work

-------            -------              --------          ----------          -----                --------

Alice              Washington    Orlando        Miami              Las Vegas      Los Angeles

Bob              Orlando            Miami          Daytona          New York      Chicago

Bill                Chicago            New York    Baton Rouge    Little Rock      Houston

 

What I would like to do is return the rows of all people who had any connection to Chicago  (in this case Bob and Bill), in other words (in pseudo code) SELECT * WHERE any field = 'Chicago'

 

 

Of course, I could always use an "OR" statement. But what if my database had, say, 100 fields.  Is there a really slick way to do it ?

 

many thanks

Link to comment
https://forums.phpfreaks.com/topic/208164-select-if-a-value-is-in-any-field/
Share on other sites

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.