and replace it with a BS12-like alternative where you can reference similar stuff by name. SQL was chosen by IBM over BS12 because they thought managers would relate to its more English-like grammar. IOW, SQL is the COBOL of relational languages.
Anyhow, I still don't know why the simple one worked but the more complex one did not. If I get time, I will incrimentally strip the bigger one piece by piece until it works. So much for pair programming. (Or if I get too fat: *pear* programming.)