support using same scalar as output and inside where clause

added tests