Ok, so here's the tables:
Table: Comments
job_id
tstamp
analyst
summary
detail
Table: Jobs
job_id
analyst
summary
detail
state
Table: Job_track
job_id
tstamp
analyst
type
So this is the query I'm using to select all jobs with comments...
select jobs.job_id as 'id', job_track.tstamp as 'opened', job_track.type as 'type', comments.tstamp, comments.summary from jobs,
job_track, comments where job_track.job_id = jobs.job_id and comments.job_id = jobs.job_id and jobs.state = 'open' and
job_track.tstamp < '20010108100000' group by id order by id,opened;
Then to get all jobs without comments, it'd be something like....
select jobs.job_id as 'id', job_track.tstamp as 'opened', job_track.type as 'type', comments.tstamp, comments.summary from jobs,
job_track, comments where job_track.job_id = jobs.job_id and ISNULL(comments.job_id) and jobs.state = 'open' and
job_track.tstamp < '20010108100000' group by id order by id,opened;
It can't be that easy? 😉
Thanks,
Craig