473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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));
  4.  
Oct 27 '12 #1
2 2423
zmbd
5,501 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

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

Similar topics

0
by: Craig Westerman | last post by:
I'm trying to help a friend with this. When I run this everything is fine SELECT * from clicks, urls WHERE clicks.url=urls.url AND urls.description IS NULL The clicks table has 31 instances of...
0
by: Ralph Guzman | last post by:
TASK: I have to generate a report with all categories, subcategories and products in database. PROBLEM: I want to write one query that will return: 1. category 2. subcategory: determined by...
0
by: Marek Lewczuk | last post by:
Hello, I have a strange problem, maybe some of you will be able to explain me something. I use LEFT JOIN as a substitute for subselects. It's true that many subselects can be rewriten using LEFT...
5
by: Marek Kotowski | last post by:
In MySQL online documentation there are some examples with multi-tables left joins. But all of them are like this (taken from the documentation): SELECT ... FROM table1 LEFT JOIN table2 on...
1
by: Mark Reed | last post by:
Hi All, I have a table with a date field and 6 number fields. The number fields are not in numerical order across the fields and I want number 1 to be the lowest number and number 6 to be the...
0
by: yeahuh | last post by:
Quick and dirty version. Godaddy server using MySQL 4.0.24 I’m trying a left join to obtain id’s in table A(cars) that are NOT in car_id in table B(newspaper): *This is a cut down version...
0
by: djflow | last post by:
Hi! II was wondering if you can help me with SQL query.. Below 7 separated select query works fine(only when they are retrieved separately) But I want to combined them together and so that i...
3
code green
by: code green | last post by:
I have a parent table `products` that contains all company products. The product details are divided amongst 4-5 product details child tables such as `paper`, `pens`, `books`, `sets`, `pens_paper`....
1
by: lawardy | last post by:
Hi, I'm quite new with Reporting server 2005. I'm wondering if there is a way to write a select query that will get the data from 2 diffrent tables located in 2 diffrent database box. for...
1
by: Nettle | last post by:
Purpose: This is a Distribution List database. Function: Users create many different email distribution lists, tailoring each to fit their specific needs Wanted: Users can combine...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.