DELETE FROM `tblSalesDetails` WHERE NOT EXISTS(SELECT NULL FROM `tblSales` WHERE tblSales.`salID` = `salDetSaleID`)