Hello everybody, I have a question with regards to a sql select statement and 
was hoping someone could help. I'm trying to query a table
and trying to return row where a condition is true.

To give you a better idea; picture a event table. A job can have muliple events 
ex, an event to indicate the job is logged,
an event to indicate the job is closed, an event to indicate the job is open 
etc etc.

Each job has a unique job id that is stored in the job table and the job_id 
column is also present in the event table (foreign key I suppose)

I'm trying to run a query that returns a recordset if it has an event present 
in the event table but also if another event is missing from that table for a 
particular job

This will give you a better idea

SELECT     EventCode
FROM         job
INNER JOIN Event ON Event.job_id = job.job_id
WHERE     (EventCode = 100) AND EventCode <> 150 AND (job_id = '1234567890')

The above select statement returns a recordset if the event code 150 is present 
in the event table. But I want it to
only return a recordset if the table contains the eventcode 100 and does not 
contain the eventcode 150.

Can somebody show me how to do this please

Best regards
coder

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195206
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to