I have the following data
Users : user(varchar), entreprise_1(int), entreprise_2(int) Entreprise: idx(int, prim, auto_incr), code(varchar)
some users have one entreprise, and some two.
if I decide that 'no entreprise x' is coded with entreprise_x=0, i have obviously a problem with
SELECT Users.* FROM Users, Entreprise Entreprise1, Entreprise Entreprise2 WHERE entreprise_1=Entreprise1.idx AND entreprise_2=Entreprise2.idx AND (Entreprise1.code='CODEX' OR Entreprise2.code='CODEX');
since
SELECT Users.* FROM Users, Entreprise Entreprise1, Entreprise Entreprise2 WHERE entreprise_1=Entreprise1.idx AND entreprise_2=Entreprise2.idx
returns 0 tuples when entreprise_2=0
In fact, i'm looking for the smartest way to code 'nothing'.
For the moment, i've created the Enterprise 'dummy' (idx=0, code='VOID'), but i absolutely not satisfied with this solution.
Any idea ?
Thank you all by advance
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]