Extend condition for selecting samples from DB