search result - coacentanating?
Hi there
If I wanted to do a search by âfirstname surnameâ what would the sql be like? Would I need to join them with a +?
For example I want to search for âdavid smithâ rather than just âsmithâ
At the moment itâs like this:
if Trim(request("txtSearch")) <> Empty then
SQLSearch = SQLSearch & " product.firstname LIKE '%"& Replace(request("txtSearch"), "'", "''") &"%' OR "
SQLSearch = SQLSearch & " product.productname LIKE '%"& Replace(request("txtSearch"), "'", "''") &"%' OR "
etc
But if I wanted to search by product.firstname and product.surname as one?
Would it be something like this:
SQLSearch = SQLSearch & " product.firstname LIKE '%"& Replace(request("txtSearch"), "'", "''") &"%' + product.productname LIKE '%"& Replace(request("txtSearch"), "'", "''") &"%' OR "
SQLSearch = SQLSearch & " product.firstname LIKE '%"& Replace(request("txtSearch"), "'", "''") &"%' OR "
SQLSearch = SQLSearch & " product.surname LIKE '%"& Replace(request("txtSearch"), "'", "''") &"%' OR "
etc?
Thanks in advance.
|