Hi,

I am new to this list so I apologise if this is not the place to post this message.

I am in the final stages of completing a project and I have one query that is causing problems.

I need the query to get a story or stories from the story table and journalists from the journalist table where their respective id is not present in a table which links the journoid to a national option table and the storyid to the national option table.

So far I have:

SELECT storySub.storyid, storySub.headline, journoDetails.journoid, journoDetails.journoName, journoNatOpt.journoid AS natJid
FROM releaseManager, journoDetails LEFT JOIN journoNatOpt ON journoDetails.journoid = journoNatOpt.journoid, storySub
WHERE storySub.isNational = 1
AND journoDetails.isNational = 1
AND journoDetails.isApproved = 1
AND journoNatOpt.journoid = ''
AND releaseManager.storyid = storySub.storyid
AND releaseManager.isReleased = 1
AND releaseManager.immediateRelease = 0
AND releaseManager.releaseTime BETWEEN #CreateODBCTime(Now())# AND #CreateODBCTime(DateAdd("n", 30, Now()))#
AND releaseManager.releaseDate BETWEEN #CreateODBCDateTime(Now())# AND #CreateODBCDateTime(DateAdd("h", 24,Now()))#

The above query seems to have trouble when I insert the following: AND journoNatOpt.journoid = ''
If I remove this line then I see all the of national stories and any national journalists which is fine except that some of the stories and journalists are actually linked to a national option. What I want to have is all stories and journalists that are national but where they are not linked to a national option.

If this makes any sense and you can see what I am doing wrong then please help!!

Thanks in advance

Dave Phipps
MySQL new guy!!


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to