Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

joined table delete not working

Status
Not open for further replies.

citychap26

Programmer
Sep 19, 2004
144
GB
Hi All,

Getting rather annoyed by a simple delete:

DELETE tblCust.*
FROM tblCust, tblTeam
WHERE tblCust.team = tblTeam.ID
AND tblCust.name="ken" AND tblTeam.subName="b1";

It returns an error (could not delete from specified tables)

Where am I going wrong?

Cheers

SK
 
DELETE tblCust.*
FROM tblCust INNER JOIN tblTeam ON tblCust.team = tblTeam.ID
WHERE tblCust.name="ken" AND tblTeam.subName="b1";

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,

Thanks but it did not work :eek:(

Still got the same error...
 
Is referential integrity enforced? Are you trying to delete parent records that still have child records?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Nope it has nothing to do with referential integrity.

Here's what I did in Oracle to delete

DELETE *
FROM TBLCUST
WHERE name in (SELECT a.NAME
FROM TBLCUST a, TBLTEAM b
WHERE a.team = b.ID
AND a.NAME = 'ken'
AND b.subName = 'b1');

I pulled this over to MS Access and it works. However there would be a problem if more than two fields needed to be used. Not sure if I could have to 'in' statments?

Cheers

SK
 
I think if you need to use two fields you can use the EXISTS statement, but I'm not real clear how it works!! Always new things to learn!!

les
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top