>>Wouldn't LEFT JOIN ON alltrim(upper(table1.aid))==alltrim(upper(table2.bid)) work regardless?
>>
>Yes, it would. Never used such construction in JOIN myself, but it would work regardless, you're right. Do you have NULL in any of ID fields?
No you don't need alltrim() but may need upper(). You already used "==" operator, right? It ensures that trailing spaces are not important.
Cetin