I recently had to reverse engineer an old MS Access utility that stopped working as expected. Yes, I know the real WTF is that it uses Access, but it's a single user utility and the process it performs is actually quite in line with Access's capabilities. Basically it takes in a delimited text file, runs some queries, and exports another delimited text file.
So as I'm stepping through the queries, I come across this little gem in one of the WHERE clauses.
WHERE (IIf( Postdate >= Priordate, 0, IIf( Postdate = Asofdate, 0, 1) )
OR
IIf (IsNull(Checkno),0,1) ) =0
Trust me, I cleaned it up a lot for readability but notice the placement of the OR as a bitwise operator instead of a comparison operator. I have a pretty good idea who actually wrote this utility so I found myself wondering whether it was ignorance or brilliance until I tested how Access treats the OR operator when used like this. I am now convinced it was ignorance.
According to Access "0 OR 0 = 0". "0 OR 1", "1 OR 0", "1 OR 1" all return -1. Actually, anything except "0 OR 0" returns -1.
And if you use AND in the same manner, anything with 0 returns 0.