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 |
treblesix
Starting Member
4 Posts |
Posted - 2006-09-14 : 03:36:47
|
Hi all, I have the following problem, which I hope someone can help with.....I have 2 tables. tblVacOrder and tblVacancies, with the following data...........tblVacOrderOrderID VacancyID1 1344 1324 1334 1366 1326 1356 136 tblVacanciesVacancyID132133134135136 I only want to return the vacancies not associated with the order i.e.If the OrderID=1, then I only want to return VacancyID's 132,133,134,135,136If the OrderID=4, then I only want to return VacancyID's 134 and 135 If the OrderID=6, then I only want to return VacancyID's 133 and 134 Anybody know a solution to this ?Cheers,Trebz |
|
treblesix
Starting Member
4 Posts |
Posted - 2006-09-14 : 03:42:51
|
Soz, that should be.........I only want to return the vacancies not associated with the order i.e.If the OrderID=1, then I only want to return VacancyID's 132,133,135,136If the OrderID=4, then I only want to return VacancyID's 134 and 135If the OrderID=6, then I only want to return VacancyID's 133 and 134 |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-09-14 : 03:50:09
|
[code]select *from tblVacancies vwhere not exists (select * from tblVacOrder x where x.OrderID = @OrderID and x.VacancyID = v.VacancyID)[/code] KH |
 |
|
treblesix
Starting Member
4 Posts |
Posted - 2006-09-14 : 03:54:58
|
Woah! That was a fast reply.It works great!Thanks for your help! / diolch yn fawr i ti'n helpu! |
 |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-09-14 : 04:04:13
|
quote: diolch yn fawr i ti'n helpu
WHICH LANGUAGE IS THIS ..??? Chirag |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-09-14 : 04:13:00
|
Welsh ? KH |
 |
|
treblesix
Starting Member
4 Posts |
Posted - 2006-09-14 : 04:16:43
|
It's Welsh / Cymraeg |
 |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-09-14 : 04:25:08
|
good guess Tan .. you know Welsh?? :-)Chirag |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-09-14 : 04:40:59
|
quote: Originally posted by chiragkhabaria good guess Tan .. you know Welsh?? :-)Chirag
Google. Google gives me the hint.  KH |
 |
|
|
|
|
|
|