Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 query joins

Author  Topic 

simflex
Constraint Violating Yak Guru

327 Posts

Posted - 2002-09-15 : 15:09:02
dear gurus!I have a table called courses, another called hr.
Within courses table, I have a field called course and another called requiredCourse and yet another called recommendedCourse and another called positionNo.
Then in the hr table, there is a field called positionNo (primary key), a key field called positionTitle, fname, lname and hiredate.
What I would like to do is write a code that says give me all the required courses and the name of the employees who are supposed to take them.
Have they taken the courses?
If the answer is yes, put a checkmark on a checkbox.
If they have not, put an X.
How can I handle this?
Thanks in advance

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-09-15 : 18:12:53
Okay, I don't quite understand what you got here. I don't see anywhere in this layout that states who took what course. to get a list of employee names with the course they need to take

select fname,lname,requiredCourse from courses inner join HR on HR.positionno = courses.positionno

this wiill state thier name and the required course. I am assuming it will be 1 hr record to many courses... so the output will look something like

bob smith course101
bob smith office typing skills 104
bob smith sitting on butt 101
phil meup course 101
phil meup course 505


something like that. As for the second part of your question, is there a location that states whether or not that person took the course?

You may want to take a look at your table layout on this one man. It almost seems like you need a thrid table to track who takes what. Another point... You may need a fourth table to link up which employees need which courses (i guess the thrid one would work for this...).

If you want send me an email and I'll help you set this up a little better. Although I'm really hoping it's not a home work assignment.

And for your last question... SQL doesn't really provide anything that gives you nice check boxes if they are and x's if they aren't... You need to be using something like Access (unless theres some new graphical interface for queries now). I guess ASP could do it too.

[edit] typo city.. damn

-----------------------
Take my advice, I dare ya


Edited by - M.E. on 09/15/2002 18:16:49
Go to Top of Page

simflex
Constraint Violating Yak Guru

327 Posts

Posted - 2002-09-15 : 19:11:36
Thanks M.E.
I have just sent you an email.
Thanks for your help!



quote:

Okay, I don't quite understand what you got here. I don't see anywhere in this layout that states who took what course. to get a list of employee names with the course they need to take

select fname,lname,requiredCourse from courses inner join HR on HR.positionno = courses.positionno

this wiill state thier name and the required course. I am assuming it will be 1 hr record to many courses... so the output will look something like

bob smith course101
bob smith office typing skills 104
bob smith sitting on butt 101
phil meup course 101
phil meup course 505


something like that. As for the second part of your question, is there a location that states whether or not that person took the course?

You may want to take a look at your table layout on this one man. It almost seems like you need a thrid table to track who takes what. Another point... You may need a fourth table to link up which employees need which courses (i guess the thrid one would work for this...).

If you want send me an email and I'll help you set this up a little better. Although I'm really hoping it's not a home work assignment.

And for your last question... SQL doesn't really provide anything that gives you nice check boxes if they are and x's if they aren't... You need to be using something like Access (unless theres some new graphical interface for queries now). I guess ASP could do it too.

[edit] typo city.. damn

-----------------------
Take my advice, I dare ya


Edited by - M.E. on 09/15/2002 18:16:49



Go to Top of Page
   

- Advertisement -