I am having trouble with a query that gives me
activities that have not been "written up" but if
these activities are a party they whould only appear
in the query if they have been held, hence date will
not='0000-00-00'

If I write the query as so, no non-party activities
will show up because the foreign key P_ID will be null
and not match the p.ID.

SELECT a.description
FROM activity a, party p 
WHERE a.write_up IS NULL
AND a.P_ID=p.ID 
AND p.date!="0000-00-00"; 

IF I allow for a.P_ID null with logical OR (like so
)it's a mess

SELECT a.description
FROM activity a, party p 
WHERE a.write_up IS NULL
AND ((a.P_ID=p.ID AND p.date!="0000-00-00")
OR a.P_ID IS NULL)); 

Any help on how I can get this to work would be
greatly appreciated.

Richard

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

Reply via email to