Your second clause is redundant.
In effect your query reads:
select * from customers where id in (...)
This can select at most one customer per id.
Instead use:
SELECT *
FROM customer
INNER JOIN address ON customer.ID = address.customer_ID
INNER JOIN sites ON address.ID = sites.address_ID
WHERE upper(customer.$field) LIKE'%$query%'
smantscheff
Nearly a Posting Virtuoso
1,297 posts since Oct 2010
Reputation Points: 321
Solved Threads: 270
Skill Endorsements: 8