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
 General SQL Server Forums
 New to SQL Server Programming
 Help in Displaying Records

Author  Topic 

Catalinaeva
Starting Member

2 Posts

Posted - 2010-10-27 : 15:34:47
Hello,

I'm still learning SQL Server 2005, and I've been given a task that requires me to write a query that shows all users who have not taken a training session called HPO. I know how to display users that have taken the training session, but I'm having trouble showing all of the active users who have not taken the session (HPO session). In other words, I want to write a query that shows all users/userids who have no taken the HPO. Can anyone please help me write this query.

Here is my code so far, and thanks in advance.


SELECT training, agency, years_attended, tid, firstname, lastname, mi, EDU, student, stu_program, ORG_CODE, ORG_NAME, ORG_ABBV, nickname, account,
emailaddress, active, photo_path, POSITION_TITLE, GRADE, PP, POSITION_TYPE, TEN, DOB, SCD, SEX, HIREFY, yos, age, userid,
isexternal
FROM qTrain
WHERE (training = 'HPO')




tpiazza55
Posting Yak Master

162 Posts

Posted - 2010-10-27 : 16:14:56
what field determines whether they have or have not taken HPO?

just add it into the where statement

WHERE (training = 'HPO') AND Active = 'VALUE' AND HPOTakenFieldName = VALUE
Go to Top of Page

Catalinaeva
Starting Member

2 Posts

Posted - 2010-10-27 : 17:43:12
Thanks!
Go to Top of Page
   

- Advertisement -