|
-
Jun 10th, 2003, 04:38 PM
#1
SQL Not Equal Query [Resolved By memnoch and apps_tech]
Hi,
I need a sql query but dont know how to write it. I have two table one called Staff and other Contracted_Staff. Now who ever is assigned a contract the StaffId is entered into Contracted_Staff Table, so that way i know which staff is assigned to what contract.
Now on the new contract section i want to select all the Staff from the table Staff who has not been assigned to any contract (available staff in other words). I want to exclude all the Staff who are in Contracted_Staff table. Now i do i go about writing that query.
Thanks for your help.
Danial
PS: Sorry for posting this in General VB, but i really need the answer urgently.
Last edited by Danial; Jun 10th, 2003 at 05:04 PM.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Jun 10th, 2003, 04:49 PM
#2
Frenzied Member
something like
Code:
SELECT * FROM Staff WHERE staffId NOT IN SELECT staffId FROM contracted_staff
it will select all staff members who are not contracted.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Jun 10th, 2003, 04:50 PM
#3
Hyperactive Member
Re: SQL Not Equal Query
Try this:
Select * from Staff where staffId Not in ( select distinct staffid from contracted_staff)
Hope this works..do let me know if not...
Enjoy!!!
apps_tech
-
Jun 10th, 2003, 04:54 PM
#4
Re: Re: SQL Not Equal Query
Originally posted by apps_tech
Try this:
Select * from Staff where staffId Not in ( select distinct staffid from contracted_staff)
Hope this works..do let me know if not...
Enjoy!!!
apps_tech
That worked like a charm !!
Thanks Millions to both memnoch and apps_tech.
Danial
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Jun 11th, 2003, 08:41 AM
#5
Hyperactive Member
Re: SQL Not Equal Query
Try this:
Select * from Staff where staffId Not in ( select distinct staffid from contracted_staff)
Hope this works..do let me know if not...
Enjoy!!!
apps_tech
-
Jun 11th, 2003, 08:44 AM
#6
Hyperactive Member
Re: Re: SQL Not Equal Query
Originally posted by apps_tech
Try this:
Select * from Staff where staffId Not in ( select distinct staffid from contracted_staff)
Hope this works..do let me know if not...
Enjoy!!!
apps_tech
Sorry, some trouble in my system my answer got posted again...
apps_tech
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|