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
 General SQL Server Forums
 New to SQL Server Programming
 SQL statement help

Author  Topic 

engcanada
Starting Member

39 Posts

Posted - 2008-06-08 : 13:54:08
Hi,
Can someone please show me how to write the follwing sql statement. I need to obtain all records from tabel_1, column idregister that do not exist in table_2 matching the column idresume.

Thank you
Simon

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-08 : 14:05:26
[code]SELECT t1.*
FROM table_1 t1
LEFT table_2 t2
ON t2.idresume=t1.idregister
WHERE t2.idresume IS NULL[/code]
Go to Top of Page

engcanada
Starting Member

39 Posts

Posted - 2008-06-08 : 14:27:43
Thank you,
This is what I used:
SELECT t1.* FROM teacher t1 LEFT resume t2 ON t2.idresume=t1.idregister WHERE t2.idresume IS NULL

and I receive the following error:

Microsoft OLE DB Provider for SQL Server error '80040e14'
'resume' is not a recognized join option.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-08 : 14:44:41
quote:
Originally posted by engcanada

Thank you,
This is what I used:
SELECT t1.* FROM teacher t1 LEFT JOIN resume t2 ON t2.idresume=t1.idregister WHERE t2.idresume IS NULL

and I receive the following error:

Microsoft OLE DB Provider for SQL Server error '80040e14'
'resume' is not a recognized join option.


sorry missed a JOIN clause there
Go to Top of Page

engcanada
Starting Member

39 Posts

Posted - 2008-06-08 : 14:46:13
Hi,
I use LEFT JOIN instead of LEFT and it worked:

SELECT t1.* FROM teacher t1 LEFT JOIN resume t2 ON t2.idresume=t1.idregister WHERE t2.idresume IS NULL

Thanks again
Go to Top of Page
   

- Advertisement -