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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |