SELECT ...
  FROM TABLE1 a,
       TABLE2 b,
  LEFT JOIN TABLE3 c ON a.field1 = c.field1
                    AND c.field3 != 'string'
 WHERE a.field1 = b.field1;

If field3 in table c can be NULL and you still want to have this record
included you have to modify it to

...
   AND ifnull(c.field3,'string') = 'string'
...


Please know that there is a differences of a column being NULL or if no
record exists for specific join condition!

Cheers
/rudy

-----Original Message-----
From: Krasimir_Slaveykov [mailto:[EMAIL PROTECTED] 
Sent: donderdag 10 juli 2003 12:37
To: [EMAIL PROTECTED]
Subject: constructing SQL problem

Hello ,

I have a problem with constructing correct SQL.
I have tables:
               TABLE1 wich have FIELD1 and FIELD2
               TABLE2 wich have FIELD1 and FIELD2
               TABLE3 wich have FIELD1, FIELD2 and FIELD3

I have this SQL:
                select a.field1, a.field2, b.field2, c.field2
                from   TABLE1 as a, TABLE2 as b, TABLE3 as c
                where  a.field1=b.field1 and
                       a.field1=c.field1 and
                       c.field3<>'string'

My problem is that when C.FIELD3 is null  i.e. in TABLE3 no record,
these records are excluded from results. I needed them nevermind they
have record in TABLE3 or not.
 Anyone help?








-- 
Best regards,
 Krasimir_Slaveykov                          mailto:[EMAIL PROTECTED]
                            [EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to