Added id only primary key check to query condition