By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,509 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,509 IT Pros & Developers. It's quick & easy.

Delete query with multiple tables and left join

P: 51
Can someone please help me with this SQL? I am very ignorant, but am trying to learn! lol

I am trying to delete the records in tblMinsitries where this criteria is met. This works as a select query, but not as a delete query. Please help!

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM tblMinistries LEFT JOIN tblCallLog ON tblMinistries.tblMinistries_ministryID=tblCallLog.tblCallLog_ID
  3. WHERE (((tblCallLog.tblCallLog_dateStamp)<>tblMinistries.tblMinistries_lastAccessedDate And tblMinistries.tblMinistries_lastAccessedDate Is Not Null)) Or (((tblCallLog.tblCallLog_dateStamp) Is Null And tblMinistries.tblMinistries_lastAccessedDate Is Not Null));
  4.  
Oct 27 '12 #1
Share this Question
Share on Google+
2 Replies


zmbd
Expert Mod 5K+
P: 5,287
What error are you receiving?
I suspect something about related records?
You'll need to either find and delete those records first or change the table relationships to allow cascade deletions as-well-as the cascade updates in the enforcement section.


To confirm this we may need to see the relationships between the involved tables too. You can either type them as a list (for an example, see my post #28 in thread Crosstab on Three tables) or you can do a screen shot and post the cropped down picture ( as I've done in post #8 in Many-to-Many-to-Many Relationship
Oct 27 '12 #2

P: 51
Thank you for the help. I have since realized a design modification that would make this much more efficient and not require this query at all.

Thank you!!!!
Oct 27 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.