473,403 Members | 2,359 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,403 software developers and data experts.

Deleting records in one table having a matching related record in another table?

MLH
DELETE tblPreliminaryVINs.* FROM tblPreliminaryVINs INNER JOIN
tblVehicleJobs ON tblPreliminaryVINs.PVIN = tblVehicleJobs.SerialNum;
The above SQL does not work for me. I get an error
I cannot delete the record(s) because of READONLY
and PERMISSIONS related issues.

I can hilite (select) the record in the table and delete it. I can
use the following SQL to delete record(s) in tblPreliminaryVINs
DELETE tblPreliminaryVINs.* FROM tblPreliminaryVINs;

But I really only want to delete records in tblPreliminaryVINs whose
[PVIN] field has a matching value somewhere in blVehicleJobs's
[SerialNum] field. How do I construct that SQL?
Jul 26 '06 #1
2 1544
try it this way:

DELETE * from FROM tblPreliminaryVINs Where PVIN In (Select SerialNum
From tblVehicleJobs)
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jul 26 '06 #2
MLH
That was perfect, Rich. Many thx.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On 26 Jul 2006 15:13:09 GMT, Rich P <rp*****@aol.comwrote:
>try it this way:

DELETE * from FROM tblPreliminaryVINs Where PVIN In (Select SerialNum
From tblVehicleJobs)
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jul 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: tom | last post by:
I am new to SQL administration. >From a list of IDs that are the primary key in one table (i.e. Customer Table), I want to make changes in tables that use those IDs as a foreign key. ...
5
by: Alex | last post by:
Hi, I have two tables , A and B where table B has a foreign key constraint to table A. I want to delete all records in table A that are older than a certain date that are not referenced by...
6
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form...
2
by: Colm O'Hagan | last post by:
Hi there, I having a problem with a database I'm setting up, I would be delighted if someone out there could help. The database I'm setting up is a task register datebase, it will be used to...
0
by: CSDunn | last post by:
Hello, In an Access 2003 Project, I have a main form called ‘frmRCAddendumInputMain' that contains a subform called ‘frmRCAddendumInputSub'. The main form opens upon clicking a button from...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
1
by: Coll | last post by:
I'm working on a database that someone else created. I have a form - frm_main that is based on a query that is based on two tables. The join is such that the first table tbl_JCN has all records...
4
by: jbrumbau | last post by:
Hello, I have been successfully using a database I've created for several months to populate an equipment list for a project we've been working on. However, the form has recently stopped working...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.