473,385 Members | 1,647 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,385 software developers and data experts.

Delete query

I'm using Access2000 and I've got a problem with a delete query which
I'm *sure* I had working before )-: I have a table (logfile) which I
import from an external source that has a load of stuff I don't need.
So I have another table (tests_not_reqd) that lists the tests I don't
need. Link 'em together with an inner join to see the tests in
'logfile' that I don't need - all looking good so far ...
SELECT Logfile.*
FROM tests_not_reqd INNER JOIN Logfile ON tests_not_reqd.test_code =
Logfile.[Test Code];

When I change it to a 'delete' query ...
DELETE Logfile.*
FROM tests_not_reqd INNER JOIN Logfile ON tests_not_reqd.test_code =
Logfile.[Test Code];

.... it gives an error 'could not delete from specified tables'. I'm
guessing it's something really simple I'm doing wrong - can anyone
help?

Simon Harris
Nov 13 '05 #1
1 2639
You need to use a sub-query for this:

DELETE Logfile.*
FROM tests_not_reqd
WHERE test_code In (SELECT [Test Code] FROM Logfile)
"Simon Harris" <si**********@kingshc.nhs.uk> wrote in message
news:d8**************************@posting.google.c om...
I'm using Access2000 and I've got a problem with a delete query which
I'm *sure* I had working before )-: I have a table (logfile) which I
import from an external source that has a load of stuff I don't need.
So I have another table (tests_not_reqd) that lists the tests I don't
need. Link 'em together with an inner join to see the tests in
'logfile' that I don't need - all looking good so far ...
SELECT Logfile.*
FROM tests_not_reqd INNER JOIN Logfile ON tests_not_reqd.test_code =
Logfile.[Test Code];

When I change it to a 'delete' query ...
DELETE Logfile.*
FROM tests_not_reqd INNER JOIN Logfile ON tests_not_reqd.test_code =
Logfile.[Test Code];

... it gives an error 'could not delete from specified tables'. I'm
guessing it's something really simple I'm doing wrong - can anyone
help?

Simon Harris

Nov 13 '05 #2

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

Similar topics

1
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB...
2
by: Joe Del Medico | last post by:
I have two tables A & B and I want to delete all the records in A that are not in B. Can I do this in the query builder? It seems like a simple problem. I can easily find the records in A that...
5
by: ms | last post by:
Why does this select query return the correct records but when I make it a delete query I get a msgbox with "Could not delete from specified tables". SELECT BMIDLog.* FROM stageBMIDLog INNER...
2
by: Dave Burt | last post by:
Hi, Access officionados, I'm new here, so please cut me slack/gently tell me off if I'm out of line or in the wrong place. OK, here's something that seems silly (and is also problematic to...
8
by: John Baker | last post by:
Hi: Access 2000 W98! I have a table with numerous records in it, and am attempting to delete certain records that have been selected from it. These are selected based on the ID number in a...
13
by: forbes | last post by:
Hi, I have a user that used the Query Wizard to create a query in Access. Now she claims that her master table is missing all the data that was excluded from the query. Can you create anything...
3
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
1
by: Matt | last post by:
I am writing a DELETE statement and I want to filter the records using another SELECT statement. My SELECT statement is a GROUP BY query that grabs all social security numbers from the "Data...
5
by: Bob Bridges | last post by:
Start with two tables, parent records in one and child records in the other, a one-to-many relationship. Create a select statement joining the two. Display the query in datasheet mode. When I...
3
by: Phil Stanton | last post by:
I have a form based on a complex query (Lots of tables) If I delete a record, everything appears to be OK. Get the message "Youa are about to delete 1 record ....". I say yes. The record count...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.