A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Deleting Outer Join Records



 
 
Thread Tools Display Modes
  #1  
Old May 9th, 2005, 07:04 PM
Suzie Raboin
external usenet poster
 
Posts: n/a
Default Deleting Outer Join Records

Ok, I have a database that contains a table with current construction
projects. It will soon contain a table with the updated constructions
projects. I have a Left Outer Join that returns the records that are in the
Original_Table but not in the Updated_Table. Using the following concept:

SELECT *
FROM Original_Table LEFT JOIN [Updated_Table] ON Original_Table.ID =
[Updated_Table].ID
WHERE [Updated_Table].ID IS NULL;

Is there a way to get Access to delete these records? I changed it into a
delete query and I keep getting the following message:

"Specify the table containing the records that you want to delete."

I am assuming that this message appears because it adds the
[Updated_Table].ID field to the query. Does anyone have any suggestions?

Thanks in advance,
Suzie
  #2  
Old May 9th, 2005, 08:17 PM
Michel Walsh
external usenet poster
 
Posts: n/a
Default

Hi,


Add DISTINCTROW from the delete query:


DELETE DISTINCTROW tableNameToDeleteFrom.* FROM table1 SOME JOIN table2
.....


Note also that you have to specify FROM WHICH table you delete, since the
JOIN implies many tables, and you probably wisely wish to delete from just
one of them.



Hoping it may help,
Vanderghast, Access MVP


"Suzie Raboin" wrote in message
...
Ok, I have a database that contains a table with current construction
projects. It will soon contain a table with the updated constructions
projects. I have a Left Outer Join that returns the records that are in
the
Original_Table but not in the Updated_Table. Using the following concept:

SELECT *
FROM Original_Table LEFT JOIN [Updated_Table] ON Original_Table.ID =
[Updated_Table].ID
WHERE [Updated_Table].ID IS NULL;

Is there a way to get Access to delete these records? I changed it into a
delete query and I keep getting the following message:

"Specify the table containing the records that you want to delete."

I am assuming that this message appears because it adds the
[Updated_Table].ID field to the query. Does anyone have any suggestions?

Thanks in advance,
Suzie



  #3  
Old May 9th, 2005, 08:31 PM
Suzie Raboin
external usenet poster
 
Posts: n/a
Default

The DISTINCTROW doesn't help me much. How do I specify which table the
records should be deleted from? When I change the query to a delete query my
SQL looks like the following (this was created by Access when I changed the
type of query):

DELETE DISTINCTROW *
FROM Original_Table LEFT JOIN [Updated_Table] ON Original_Table.ID =
[Updated_Table].ID
WHERE [Updated_Table].ID IS NULL;

This is when I get the error message.

Any other help is appreciated!

"Michel Walsh" wrote:

Hi,


Add DISTINCTROW from the delete query:


DELETE DISTINCTROW tableNameToDeleteFrom.* FROM table1 SOME JOIN table2
.....


Note also that you have to specify FROM WHICH table you delete, since the
JOIN implies many tables, and you probably wisely wish to delete from just
one of them.



Hoping it may help,
Vanderghast, Access MVP


"Suzie Raboin" wrote in message
...
Ok, I have a database that contains a table with current construction
projects. It will soon contain a table with the updated constructions
projects. I have a Left Outer Join that returns the records that are in
the
Original_Table but not in the Updated_Table. Using the following concept:

SELECT *
FROM Original_Table LEFT JOIN [Updated_Table] ON Original_Table.ID =
[Updated_Table].ID
WHERE [Updated_Table].ID IS NULL;

Is there a way to get Access to delete these records? I changed it into a
delete query and I keep getting the following message:

"Specify the table containing the records that you want to delete."

I am assuming that this message appears because it adds the
[Updated_Table].ID field to the query. Does anyone have any suggestions?

Thanks in advance,
Suzie




  #4  
Old May 9th, 2005, 09:01 PM
Michel Walsh
external usenet poster
 
Posts: n/a
Default

Hi,


I would suspect you delete from the table Original_Table:


DELETE DISTINCTROW Original_Table.* FROM Original_Table LEFT JOIN ...


Vanderghast, Access MVP

"Suzie Raboin" wrote in message
...
The DISTINCTROW doesn't help me much. How do I specify which table the
records should be deleted from? When I change the query to a delete query
my
SQL looks like the following (this was created by Access when I changed
the
type of query):

DELETE DISTINCTROW *
FROM Original_Table LEFT JOIN [Updated_Table] ON Original_Table.ID =
[Updated_Table].ID
WHERE [Updated_Table].ID IS NULL;

This is when I get the error message.

Any other help is appreciated!

"Michel Walsh" wrote:



  #5  
Old May 9th, 2005, 09:21 PM
Suzie Raboin
external usenet poster
 
Posts: n/a
Default

Well, I've taken care of the problem. I'm still not really sure what was
wrong with it. I just started over and now it works fine. Thanks for your
help!

"Suzie Raboin" wrote:

The DISTINCTROW doesn't help me much. How do I specify which table the
records should be deleted from? When I change the query to a delete query my
SQL looks like the following (this was created by Access when I changed the
type of query):

DELETE DISTINCTROW *
FROM Original_Table LEFT JOIN [Updated_Table] ON Original_Table.ID =
[Updated_Table].ID
WHERE [Updated_Table].ID IS NULL;

This is when I get the error message.

Any other help is appreciated!

"Michel Walsh" wrote:

Hi,


Add DISTINCTROW from the delete query:


DELETE DISTINCTROW tableNameToDeleteFrom.* FROM table1 SOME JOIN table2
.....


Note also that you have to specify FROM WHICH table you delete, since the
JOIN implies many tables, and you probably wisely wish to delete from just
one of them.



Hoping it may help,
Vanderghast, Access MVP


"Suzie Raboin" wrote in message
...
Ok, I have a database that contains a table with current construction
projects. It will soon contain a table with the updated constructions
projects. I have a Left Outer Join that returns the records that are in
the
Original_Table but not in the Updated_Table. Using the following concept:

SELECT *
FROM Original_Table LEFT JOIN [Updated_Table] ON Original_Table.ID =
[Updated_Table].ID
WHERE [Updated_Table].ID IS NULL;

Is there a way to get Access to delete these records? I changed it into a
delete query and I keep getting the following message:

"Specify the table containing the records that you want to delete."

I am assuming that this message appears because it adds the
[Updated_Table].ID field to the query. Does anyone have any suggestions?

Thanks in advance,
Suzie




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting records from main and child/sub-forms Ted General Discussion 7 May 8th, 2005 09:48 PM
How code 2 left joins in UPDATE sql ??? mscertified Running & Setting Up Queries 5 March 29th, 2005 02:38 PM
Deleting records after certain date sendahook Running & Setting Up Queries 7 March 23rd, 2005 07:00 PM
Outer join Jacques Running & Setting Up Queries 2 January 7th, 2005 04:03 PM
New records can't be seen rleblanc Using Forms 6 August 14th, 2004 02:43 PM


All times are GMT +1. The time now is 10:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.