hi all,
i have a problem which i think has an easy solution but i couldn't find it:
i have 3 tables, normalised.
one holds people:
tb_people(user_id, name, phone, bla bla bla)
the other holds equipments:
tb_equip(equip_id, eq_name bla bla bla)
and the third table has the links of the equipments to people:
tb_p_e(user_id, equip_id)
i want to select the names of people which for example have equipments 4 AND 7. it works for people with equipments 4 OR 7.
this works :
SELECT DISTINCT name FROM tb_people, tb_p_e WHERE tb_p_e.user_id=tb_people.user_id AND (equip_id=4 OR equip_id=7);
but it doesnt work for AND (of course it doesnt because it cannot select a row from tb_p_e where equip_id cannot be 4 and 7 in the same row).
i know that i can get what i want with subqueries but the server which i am working is not controlled by me and it has an old version of mysql which doesnt support subQs.
any help would be most appreciated.