• I think I understand what you're saying. If you are selecting E.FLDID and also using the count(E.FLDID) in your expressions, you're getting one row per E.FLDID, which means each expression is going to evaluate to either 0/1 or 1/1. I don't think you want E.FLDID in your Select list or your Group By.

    Unless of course, I'm misunderstanding what you're trying to accomplish.