Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    419
    Thanks
    18
    Thanked 2 Times in 2 Posts

    row search on two columns

    I'm trying to figure out how to pull a row that matches a search of two columns.

    In other words, if they search for "bob newhart" (in one search field to keep it simple for the user). I want the query to search for bob in first names, and newhart in second names, then combine to show the result.

    The query I thought would work, pulled that field, but then seemed to pull every entry after that or something like that. I only want the one row.

    Here's what I tried:
    Code:
    "SELECT concat( first_name, ' ', last_name ) AS 'bob newhart' FROM `table`"

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    419
    Thanks
    18
    Thanked 2 Times in 2 Posts
    neeever mind! I figured it out. This is what I was trying to get:

    SELECT * FROM table WHERE CONCAT(first_name,' ',last_name) LIKE 'bob newhart'


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •