I'm glad you caught that! That would be another subtle bug. That's what I get for going off the top of my head and using copy paste (thus propagating the error on and on). As to myself, no SQL expert here. I've just done enough headbanging with SQL that I know some of the pitfalls (but only some).