Query

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I'm feeling really stupid for asking this however,

Is there anyway of doing a NOT UNION ?

I'm trying to select all the records from two tables where there are
duplicates. Basically it's an IT training database and I have a table for
the courses the employees want to go on and a table for recording who has
been on the courses. I'm trying to get a query to bring back the results of
the employees who have and havn't been on the training courses.

Also how do you set up a composite key as I'm sure Course and Course Level
can be used together to form a composite key but I don't know how to do it.
 
I dont know why you would need UNION, I think you can get the results by:

1. For employees who have been on training
select emplyoee.* from employees where employeeid in (select employeeid from
emp_courses)

2. For employees who have not been on training
select emplyoee.* from employees where employeeid not in (select employeeid
from emp_courses)
 
I think the Union is required because the results are not kept on the
emp_course table.
The employee's all have courses that they would like to be on. These are
kept in the emp_course table.

Then I have a seperate table of Training. The training dates are stored on
another table. When the person has been on training and I run the query I
want to ommit the people that have been on that course.
 
Back
Top