logic for not in data model of query

Author: Ashwin