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 2000 Forums
 Transact-SQL (2000)
 select from multiple tables with filtering

Author  Topic 

fm88
Starting Member

18 Posts

Posted - 2008-05-19 : 01:11:24
I have 2 tables,tblProjIDEst and tblProjIDAct.
Both contain "projectID" field.
I want to select the "projectID"s that are found in the first table and not in the second.
For example if first table contains 1-2-3-4-5 and the second
1-2.I want to select 3-4-5.

Can someone help me in writing this query?
Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-19 : 01:30:21
SELECT projectID
FROM tblProjIDAct pa
LEFT JOIN tblProjIDEst pe
ON pe.projectID=pa.projectID
WHERE pe.projectID IS NULL
Go to Top of Page

fm88
Starting Member

18 Posts

Posted - 2008-05-19 : 02:35:03
Well,its not workin..
am I missing some information to check.
Initially both tables are empty with no data.
Its giving "Ambiguous column name projectID"...
In both tables this column exists with the same design. nvarchar(20)
any help is appreciated!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-19 : 02:45:06
Posted - 05/19/2008 : 01:30:21
--------------------------------------------------------------------------------

SELECT pa.projectID
FROM tblProjIDAct pa
LEFT JOIN tblProjIDEst pe
ON pe.projectID=pa.projectID
WHERE pe.projectID IS NULL
Go to Top of Page
   

- Advertisement -