1

Is it possible to use delete with inner join in SQL Server Compact Edition? What is the CE equivalent of this SQL Server query?

delete a from employee a inner join department b 
on a.departmentID=b.departmentID where b.departmentStatus='closed'
aldebaran
  • 695
  • 8
  • 20
  • sorry, column names were wrong, i updated the query now. – aldebaran Nov 28 '12 at 19:31
  • sql server ce does not support sub query. – aldebaran Nov 28 '12 at 19:34
  • Well, if it doesn't support joins or subqueries, what does it support? Have you considered using Express instead of Compact? – Aaron Bertrand Nov 28 '12 at 19:35
  • It supports joins but not subquery. Sql server ce is restricted compared to desktop versions because it is used on mobile devices. Normally joins work in mssqlce, i am asking if it is possible to run a query like above. – aldebaran Nov 28 '12 at 19:43
  • 1
    If you know so much about what CE supports and doesn't support, why are you asking us if the above query will work? Did you *run* the query? What happened? – Aaron Bertrand Nov 28 '12 at 19:44
  • [This question](http://stackoverflow.com/questions/8438548/sql-server-ce-can-i-delete-top-or-only-1-record-from-table-that-matches-my-query) seems to imply that delete via subquery works fine in SQL Server CE. What happened when you ran my query? Or did you not try that one either? – Aaron Bertrand Nov 28 '12 at 19:45
  • Sorry, my problem was using "=" before subquery. [This question](http://stackoverflow.com/questions/645631/subquery-in-sql-server-compact-edition) shows it is possible to use subquery. Thank you for your help. – aldebaran Nov 28 '12 at 20:01
  • Yeah, the subquery I showed - which you quickly discarded - used `IN`, not `=`. – Aaron Bertrand Nov 28 '12 at 20:07

0 Answers0