I have 3 tables.
user
id
firstname
lastname
...
user_rel_domain
user_id
domain_id
value
domain
id
name
I would like to make a search that would match the firstname, the lastname and the domain(s) name(s) if the value in user_rel_domain is higher then 0.
How could I do this in a single MySQL query?
EDIT:
Ok, I though that this idea would be easy to integrate from the 3 tables example, but I actually have 6 tables and I don’t think that the answers can be used for the structure I really have, so here it is, sorry everyone!:
user
id
firstname
lastname
...
user_rel_domain
user_id
domain_id
value
domain
id
name
user_rel_mandate
user_id
mandate_id
value
mandate
id
cat_id
name
mandate_cat
id
name
Basically I want to search in all the “name” columns and the firstname and lastname of the user table while all the value from the relation tables be higher then 0.
EDIT: Hmm… I made a few assumptions about your new requirements, so let me know if this is in the ballpark: