469,073 Members | 1,817 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,073 developers. It's quick & easy.

Delete query with multiple tables and left join

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));
Oct 27 '12 #1
2 2312
5,400 Expert Mod 4TB
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
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.

Similar topics

reply views Thread by Craig Westerman | last post: by
reply views Thread by Ralph Guzman | last post: by
reply views Thread by Marek Lewczuk | last post: by
5 posts views Thread by Marek Kotowski | last post: by
1 post views Thread by Mark Reed | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.