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
 Transact-SQL (2005)
 Deleting with a join

Author  Topic 

sross81
Posting Yak Master

228 Posts

Posted - 2008-11-05 : 11:08:37
Hello,

I have to delete records from a table based on a value that can only be found by joining to another table. I get error that says its near "a" but I don't see it unless my syntax is wrong?

delete from lab_test_add_conf a
join emr_lab_test_zseg b on a.labtest_key = b.labtestcode
where b.zsegcode = 'zci'

Thanks in Advance!
Sherri

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-05 : 11:14:18
[code]delete a
from lab_test_add_conf a
join emr_lab_test_zseg b
on a.labtest_key = b.labtestcode
where b.zsegcode = 'zci'
[/code]
Go to Top of Page

sross81
Posting Yak Master

228 Posts

Posted - 2008-11-05 : 11:16:23
Thanks!

quote:
Originally posted by visakh16

delete a
from lab_test_add_conf a
join emr_lab_test_zseg b
on a.labtest_key = b.labtestcode
where b.zsegcode = 'zci'




Thanks in Advance!
Sherri
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-05 : 11:21:29
Cheers
Go to Top of Page
   

- Advertisement -