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.
| Author |
Topic |
|
nechtmarrie
Starting Member
24 Posts |
Posted - 2013-05-03 : 04:06:24
|
| Hi,I ame currently looking for a way to generate the names of any staff members that are not assinged to a job.Basicly i have 2 tables. One contailing all the staff and their information. The second table holds jobs and they information including the assinged staff member to the job.I would like to generate a list of staff members that have not been assinged to a job yet.I was thinking about somthing whit a right join maby but i'm not too sure.Any ideas?thnx,Necht |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-03 : 04:15:21
|
this would give you an ideaSELECT *FROM stafftable sWHERE NOT EXISTS (SELECT 1 FROM Jobs WHERE AssignedStaff = s.Staff) I've assumed table and column names so make sure you use correct names instead------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
nechtmarrie
Starting Member
24 Posts |
Posted - 2013-05-03 : 04:36:03
|
| Thnx for the tip, testing it now.I will let you know how it went. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-03 : 04:43:40
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
nechtmarrie
Starting Member
24 Posts |
Posted - 2013-05-03 : 04:45:26
|
| Works like a charm, thnx alot! :) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-03 : 04:48:06
|
| you're welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|
|