Trying to use SQL Server with a jQuery autocomplete. I can get the following to work when just checking the term entered with a matching domain, but I would also like the autocomplete to check if a match is found for the contact name (first name and last name).
Is there a way (like in mySQL) to concat the fname and lname?
Domain only:
($term = data entered in autocomplete box)
SELECT distinct comp_companyid, comp_name, comp_emailaddress, comp_website, pers_firstname, pers_lastname, addr_address1, addr_address2, addr_city, addr_state, addr_postcode
FROM company, person, address, address_link
WHERE pers_companyid = comp_companyid
AND addr_addressid = adli_addressid
AND adli_companyid = comp_companyid
AND comp_website LIKE '%".$term."%';
My attempt at matching name as well:
SELECT distinct comp_companyid, comp_name, comp_emailaddress, comp_website, pers_firstname, pers_lastname, addr_address1, addr_address2, addr_city, addr_state, addr_postcode
FROM company, person, address, address_link
WHERE pers_companyid = comp_companyid
AND addr_addressid = adli_addressid
AND adli_companyid = comp_companyid
AND comp_website LIKE '%".$term."%'
OR pers_firstname + ' ' + pers_lastname LIKE '%".$term."%';
Figured it out: