Assuming eid is a foreign key to uid, then something like this should work:
select u.uid, f.fname, l.lname
from users u
inner join firstname f on u.uid = f.eid
inner join lastname l on u.uid = l.eid
where f.fname like '%will%' or
l.lname like '%will%'
If you also need to search the "uname" field, then add that to your where criteria with another or statement.
Results is:
UID FNAME LNAME
1 abc xyzs
3 czx yut
Assuming `eid` is a foreign key to `uid`, then something like this should work:
select u.uid, f.fname, l.lname
from users u
inner join firstname f on u.uid = f.eid
inner join lastname l on u.uid = l.eid
where f.fname like '%will%' or
l.lname like '%will%'
- [SQL Fiddle Demo][1]
If you also need to search the uname field, then add that to your where criteria with another or statement.
Results:
UID FNAME LNAME
1 John Williams
3 Williams Smith
[1]: http://sqlfiddle.com/#!2/b6e1c/1