validated where and having clause