SQL Server query delete results of a join from a table -
i'm not sql server expert , i'm struggling query. can help?
delete pptmaillistc.dbo.emailtables email in (select * pptmaillistc.dbo.emailtables tab1 inner join pptmaillistab.dbo.emailtables tab2 on tab1.email = tab2.email)
sql server management studio returns.
msg 116, level 16, state 1, line 1
1 expression can specified in select list when subquery not introduced exists.
basically, there 2 separate tables both called same (dbo.emailtables
) in 2 separate databases (pptmaillistc
, pptmaillistab
).
where both databases have same results (which can find out using join i.e.)
select * pptmaillistc.dbo.emailtables tab1 inner join pptmaillistab.dbo.emailtables tab2 on tab1.email = tab2.email
i want delete results of join pptmaillistc.dbo.emailtables
.
you can rid of use of in , use inner select statement , convert delete , reference alias (tab1) of table want affect this:
delete tab1 pptmaillistc.dbo.emailtables tab1 inner join pptmaillistab.dbo.emailtables tab2 on tab1.email = tab2.email
Comments
Post a Comment