Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    137

    Unanswered: help with MySQL dynamic sql

    I am developing C# winForm application. I have a textbox for searchign customer name but I want the user to enter the customer name like this:

    john mathews

    Or:

    Robert Duff

    then in MySQL I want to have a dynamic sql to search search the customer_name like this:

    SELECT * FROM customers WHERE customer_name CONTAINS john AND customer_name CONTAINS mathews

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what you're aiming for is
    Code:
    WHERE customer_name LIKE '%john%' 
      AND customer_name LIKE '%mathews%'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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