Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Delete with inner join
Wed, Nov 18 2009 4:48 AMPermanent Link

"James Relyea"
I'm not sure if delete statements with an inner join is a supported syntax
or not, but if it is, could someone post a syntax sample? I can't quite seem
to get it right this morning.

Thanks

Smile
jr

Wed, Nov 18 2009 5:15 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

James


Don't think so. You need to use a sub-select instead. This is one I build programmatically

   Archiver.SQL.Text := 'DELETE FROM ' + Source + ' WHERE';
   if Zaps[Block] in [0, 2] then Archiver.SQL.Add('(SELECT _ID FROM Contacts WHERE Contacts._ID = ' + Source + '._fkContacts ) IS NULL');
   if Zaps[Block] = 2 then Archiver.SQL.Add('AND');
   if Zaps[Block] in [1, 2] then Archiver.SQL.Add('(SELECT _ID FROM Companies WHERE Companies._ID = ' + Source + '._fkCompanies ) IS NULL');
   Archiver.ExecSQL;

Roy Lambert [Team Elevate]
Image