Posted by --CELKO-- on 10/27/07 00:36
>>. The mistake I made was that the column pers_companyid does not exist. It should have been comp_companyid. <<
Google for a recent posting of mine on scoping rules in SQL. Then
learn how to properly name data elements -- why is a personnel
company_id a totally different kind of attribute from a company
company_id? That is what different names imply! If you had obeyed
ISO-11179, your query would have run as intended.
DELETE FROM Personnel -- collective name
WHERE company_id -- scopes to Personnel
IN (SELECT company_id -- scopes to Companies
FROM Companies -- plural name
WHERE contract_expiry IS NOT NULL);
Do entire companies expire in your data model? or does some
relationship between them and your personnel expire?
Get a copy of SQL PROGRAMMING STYLE and it will help clear up your
thinking.
[Back to original message]
|