> What I really wanted to do was this (in pseudocode)
>
> Delete from SaleREF s
> where (s.CustCode, s.DestCode) not in
> (select distinct (CustCode, DestCode) from CustDest)
>
> I'm sorry but I can't pick how I need to change your code to achieve
> this.
How about:
delete from SalesRef s where not exists (select c.CustCode from
CustDest c where s.CustCode=c.CustCode and s.DestCode=c.DestCode)
Seth.
=======================================================
Seth Wagoner, WebFoundry Ltd. Christchurch, New Zealand
mailto:[EMAIL PROTECTED] http://webfoundry.co.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz