Syntax may not be exactly right, depending on the database but

DELETE FROM DocketNos n where not Exist (select d.coid from Dockets d where d.CoID = n.coID and d.Dockeno = n.DocketNo)

Mark Howard wrote:

Hi

I'm wanting to delete rows from one table, DocketNos, where corresponding rows do not exist in a second table., Dockets.
The tables are linked via a composite key made up of
CoID Char(3) and
DocketNo Integer


I'm trying the following SQL (using DBISAM)

Delete from DocketNos n where
  n.CoID||cast(n.DocketNo as Char(8)) not in
    (select d.CoID||cast(d.DocketNo as Char(8)) from Dockets d)

When I run this, I don't get any errors but it just goes away and never comes back to me.

Can anyone see if there is a problem with this or is there maybe a better way to do it? There are perhaps 50,000 rows in
each table.


TIA

Mark
 --
Forest Production Systems Ltd
Creators of PSLog - A harvesting information system
www.pslog.co.nz
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to