Delete Query Inner Join (2 Viewers)

Sreedevi

Registered User.
Local time
Today, 07:32
Joined
Oct 10, 2007
Messages
22
Hi,

I am very bad in queries and need your help on this one.

I am trying to run a simple delete query having an inner join but it gives an error every time. The error being
"Specify the table containing the records you want to delete"

here are the details of the simulated table and the query than I am trying to run

table1 :
name number
abc 1
xyz 2

table2
name city
abc A

Query that I am trying to run is:
Delete Table1 from Table1 INNER JOIN Table2 on Table1.name = Table2.name;

Thanks
 
Last edited:

Jon K

Registered User.
Local time
Today, 14:32
Joined
May 22, 2002
Messages
2,209
Try this.

DELETE DISTINCTROW Table1.*
FROM Table1 INNER JOIN Table2 ON Table1.Name=Table2.Name;
.
 

Sreedevi

Registered User.
Local time
Today, 07:32
Joined
Oct 10, 2007
Messages
22
Thanks Jon,

It worked, but just out of curiosity why does having a DISTINCTROW makes it working.


Thanks
 

oleronesoftwares

Passionate Learner
Local time
Today, 07:32
Joined
Sep 22, 2014
Messages
1,159
Having disctinctrow is used to select unique values, the two tables has a unique relationship via primary key(primary table), foreign key(secondary table)
 

Users who are viewing this thread

Top Bottom