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 2005 Forums
 Other SQL Server Topics (2005)
 Problem with sql query

Author  Topic 

georrgetjojo
Starting Member

10 Posts

Posted - 2007-09-13 : 12:58:05
Hi,
I am relatively new to database.The problem I am facing is that,I got two databasae tables called,'inventory' and 'temp' and the foreign key i am having is 'course_number' and i want to get all records in the 'temp' table that contains no reference to the 'inventory' table.that is the course_number which is not there in inventory table.can anyone help me with the sql query for this
Thanks,
George

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-13 : 13:02:32
select t.*
from temp as t
left join inventory as i on i.cource_number = t.course_number
where i.course_number is null




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

georrgetjojo
Starting Member

10 Posts

Posted - 2007-09-13 : 13:06:50
Thank you very much.It worked.
Go to Top of Page
   

- Advertisement -