SQL query that concanate 2 fields for 1 search
Posted on 2013-01-10
I have a database that have these 2 fields, name and firstname, and I want to do a query from one field that MIGHT INCLUDE both fields or JUST ONE
1 John Doe
2 George Wayne
3 John Doe
4 George Wayne
I would like to search for John, and get record 1 and 3
Search John Doe and get record 1 and 3
Search Doe and get record 1 and 3
What I am able to do with the code below is : If I search John Doe, I will only get record 3, but I want to be able to get record 1 TOO !!! (Doe is part of FirstName)
strSQl = "SELECT name, firstname FROM customers WHERE (name LIKE '*" & dt(0).Text & "*') OR (firstname LIKE '*" & dt(0).Text & "*')"
strSQl = strSQl + " order by main"
*** Also what would I need to insert IF I DON'T WANT TO INCLUDE DUPLICATES